Repository navigation
Fix special-character links and close four small issues - #55
Gabriel Mongefranco (gabrielmongefranco) wants to merge 6 commits into
Conversation
When both copy methods fail, the status message now says to select the ID shown and press Ctrl+C (Cmd+C on a Mac) instead of asking the person to copy it manually. The clipboard tests and the usage page now expect and describe the new message. Nothing else about copying changes. Closes #52
Both Refresh sites list controls used to remove the saved sites and empty the list before asking SharePoint search again, so when both the sorted request and the unsorted retry failed, the list and its saved copy were gone and Choose a site said no sites had been found yet. The loader now keeps the sites from the last successful load in memory and in browser storage until a new answer arrives, replaces them only when SharePoint answers (including with an empty list), and resolves to a loaded or kept outcome. The helper text under the Site address box is now a live status region, and it and the Choose a site status line say that the list couldn't be refreshed or loaded and what to do next. The typed address, the Find a site text, the open dialog, and focus are left as they were, and a second refresh while one is running shares the request. Playwright tests cover a failed refresh at both controls, a first-ever failure, a retry that works, an empty answer, and blocked browser storage. The usage, troubleshooting, and development pages describe the behavior.
Sitenalyzer built links to site pages and shared items with encodeURI, and built top-level folder links from the raw server-relative path, so a name with a # became a fragment and a name with a literal % or %23 was read as an escape. A new helper, snaEncodeServerRelativePath, encodes each folder and file name of a path SharePoint returns as typed, such as FileRef and ServerRelativeUrl, and keeps the slashes between them. The page inventory, the shared file and folder lookup, the top-level folder links, and the agent and site skill rows all use it now. Folder links are also kept only when they are inside the site being read, as page and shared item links already were. Addresses SharePoint has already formed, such as DefaultViewUrl, are left as they are. Site pages, the page details, and the print document now show each page's address with the names as typed, and only the link uses the encoded form. This keeps a value in a file name, such as an email address, hidden like any other text while Show hidden values is off. A browser test supplies pages, folders, a shared file, and a shared folder whose names hold #, %, the text %23, spaces, an apostrophe, and an accented letter, and checks the links on screen and in the print document. The test list in docs/development.md describes it. A reviewer should open a real site with a page and a folder whose names contain # and %, and check that Open page and the folder link open the right item in a new window with SharePoint's page router turned off.
Search this report now finds a list, library, column, or term by a word that is only in its description, with the same quoted-phrase and wildcard rules as names. Each search index entry keeps the saved description, and the search hides values that look like personal information in it before comparing, as it already does for names and synonyms, so a hidden phone number cannot be found while Show hidden values is off. A description saved in the editor is searchable at once because the index is rebuilt after the save; a draft that was not saved is not indexed. The search results help and the usage page now mention descriptions, and the tests cover a keyword found only in a list, a column, and a term description, quoted phrases and wildcards in descriptions, a hidden phone number in a description, and the saved and unsaved description cases.
When a view was replaced, Sitenalyzer kept each table's filter text but not its sort order, so a sorted table came back in its usual order after opening another section or list tab, or after Show technical details redrew the view. Each table's sort order is now remembered by its table ID in memory, next to its filter text, and set again when the table is rebuilt. A table that was never sorted opens in its usual order. A remembered sort by a column the table can't show now, such as a technical column while Show technical details is off, is left out when the table is built, and comes back when the column is shown again. Refresh report, Change site, and Start over clear the remembered order with the rest of the report. No browser storage is used. The new browser tests cover the restored order, sort indicator, and filter text; another table staying in its usual order; keyboard sorting after the order is restored; a sort by a technical column; and Refresh report and Start over. Please check by hand with a screen reader that a restored heading announces its sort order, and check the change on a SharePoint page with ?csp=enforce.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6d0797990d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "Codex (@codex) review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "Codex (@codex) address that feedback".
| var isFolder = item.FSObjType === 1 || item.FSObjType === '1'; | ||
| if (isFolder || !fileRef || !/\.aspx$/i.test(fileName)) { return; } | ||
| var pageUrl = origin + encodeURI(fileRef); | ||
| var pageUrl = origin + snaEncodeServerRelativePath(fileRef); |
There was a problem hiding this comment.
Decode page URLs before matching table filters
When Site pages contains more than 10 rows and Show hidden values is off, the filter can now find pages by hidden email fragments. Encoding each segment changes jane.doe@example.org.aspx to jane.doe%40example.org.aspx, which no longer matches the email-masking pattern. snaApplyTableFilter still examines the raw url field, and its callers enable URL decoding only for agents and skills. Consequently, filtering for jane.doe reveals the matching page even though its file name and displayed address are hidden; the previous encoding did not allow this match. Enable decoded URL filtering for pages too, or exclude their raw URL from filtering.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
🟡 Changes recommended
Encoded link fields bypass masking during table filtering, making hidden email text searchable even when Show hidden values is off.
1 open issue
What changed in this PR
This PR corrects special-character SharePoint links and improves site selection, report search, table sorting, and copy-failure guidance in Sitenalyzer.
Changes:
- Encodes file and folder path segments while keeping displayed page addresses readable and subject to hidden-value masking.
- Preserves site choices after refresh failures, searches descriptions, remembers table sort order, and clarifies manual copying.
- Adds regression tests, updates documentation, and rebuilds the distributed script.
| File | Description |
|---|---|
tests/sitenalyzer.spec.js |
Adds coverage for links, refresh failures, description search, sorting, and copy messages. |
src/sitenalyzer.js |
Implements link handling and report usability changes. |
src/sitenalyzer.html |
Makes site-list status messages available to screen readers. |
docs/usage.md |
Explains the updated controls and report behavior. |
docs/troubleshooting.md |
Adds guidance for site-list loading failures. |
docs/development.md |
Documents the added regression coverage. |
dist/SiteAssets/scripts/sitenalyzer.js |
Includes the rebuilt application logic and markup. |
Review effort: Balanced
| // read it as the start of a fragment or of an escape. Use it only on such paths, never on an address SharePoint has | ||
| // already formed, such as DefaultViewUrl, because that would encode its escapes a second time. | ||
| function snaEncodeServerRelativePath(path) { | ||
| return String(path || '').split('/').map(encodeURIComponent).join('/'); |
The filter box above a table compared each row's address in its encoded form. Since page, folder, and shared item links now encode every part of the path, an @ in a file name became %40, so the check for hidden values no longer saw an email address there. Typing part of that address into the Site pages or Top-level folders filter box found the row while Show hidden values was off. The filter now decodes every address field before it hides values and compares, the way agent and site skill addresses were already handled. Links keep their encoded addresses. A new test types part of a hidden email address into the Site pages and Top-level folders filter boxes and checks that nothing matches until Show hidden values is on. It fails without this change. Refs #42

This pull request fixes link building for names with special characters and closes the four small-effort issues. Each issue is its own commit, and each commit includes the rebuilt
dist/.Changes
#or%in a name stays in the address instead of turning into a fragment or an escape. Folder links are kept only when they are inside the site being read, as page and shared item links already were. Page addresses on screen and in print are shown with the names as typed, so an email address in a page's file name is hidden like any other text.The
*.logfiles in the repository folder were never committed. The existing*.logrule in.gitignorealready keeps them out, so no change was needed.Testing
bash build.shand the full Playwright suite: 235 tests passed.#,%,%23, spaces, apostrophes, and accented letters, an email address in a page file name, failed and empty site list refreshes with and without browser storage, description search with quoted phrases, wildcards, and hidden values, and sort order through view changes, technical details, Refresh report, and Start over.Checks to do by hand on a real site
#and%. Check that Open page and the folder link open the right item in a new window.?csp=enforceand check the browser console for Content Security Policy messages.Closes #42
Closes #44
Closes #46
Closes #47
Closes #52
cd /c/git/Sitenalyzer && gh pr create --base main --head fix/links-and-small-issues --title "Fix special-character links and close four small issues" --body-file "C:/Users/mongefrg/AppData/Local/Temp/claude/4d4013869bae06a7/32509718-59de-4122-a5cb-e42bcdaf4450/scratchpad/pr1-body.md" 2>&1 | tail -2