Skip to content

Fix special-character links and close four small issues - #55

Open
Gabriel Mongefranco (gabrielmongefranco) wants to merge 6 commits into
mainfrom
fix/links-and-small-issues
Open

Gabriel Mongefranco (gabrielmongefranco) wants to merge 6 commits into
mainfrom
fix/links-and-small-issues

Conversation

@gabrielmongefranco

Copy link
Copy Markdown
Contributor

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

  • Links with special characters (Fix links to SharePoint pages, folders, and shared items with special characters #42). Links to site pages, top-level folders, shared files, and shared folders now encode each part of the path, so a # 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.
  • Sites list on refresh (Preserve the sites list and explain refresh failures #44). Both Refresh sites list controls keep the sites from the last successful load when SharePoint search fails, and say so in a status message that screen readers announce. A first-ever failure says to try again or type the site address.
  • Search descriptions (Search list, column, and term descriptions #46). Search this report now finds lists, libraries, columns, and terms by words in their descriptions. Hidden values in descriptions can't be found while Show hidden values is off.
  • Table sort order (Remember table sort order while navigating a report #47). Each table remembers its sort order while the report is open. Refresh report, Start over, and opening another site from Change site reset it. Nothing is saved in browser storage.
  • Copy failure message (Name the copy keys in the copy failure message #52). When copying an ID fails, the message now says to select the ID and press Ctrl+C (Cmd+C on a Mac).

The *.log files in the repository folder were never committed. The existing *.log rule in .gitignore already keeps them out, so no change was needed.

Testing

  • bash build.sh and the full Playwright suite: 235 tests passed.
  • New tests cover each change, including names with #, %, %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.
  • Nothing in this pull request was tested on a real SharePoint Online site.

Checks to do by hand on a real site

  1. Open a site with a page and a folder whose names contain # and %. Check that Open page and the folder link open the right item in a new window.
  2. Make SharePoint search fail, or go offline, and select Refresh sites list on the start screen and in Choose a site. Check that the earlier sites stay listed and that a screen reader announces the message.
  3. Sort a table, open another section, and come back. Check that a screen reader announces the restored sort order on the column heading.
  4. Open the page with ?csp=enforce and 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

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.
Copilot AI balanced review requested due to automatic review settings November 5, 2026 20:37
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-08T17:56:09.694893Z b355f86 New commits
ℹ️ About Codex in GitHub

Your 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread src/sitenalyzer.js
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);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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

Comment thread src/sitenalyzer.js
// 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
Copilot AI balanced review requested due to automatic review settings November 8, 2026 17:54

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants