Skip to content

restore-file - Restore support on older PR view and GHE - #10301

Merged
fregante merged 1 commit into
refined-github:mainfrom
JoppeDC:main
Oct 21, 2026
Merged

fregante merged 1 commit into
refined-github:mainfrom
JoppeDC:main

Conversation

@JoppeDC

@JoppeDC JoppeDC commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Fix actionable-pr-view-file crash on legacy PR files view

On the legacy "Files changed" view, parseReference() read the full
user/repo:branch reference from the element after .head-ref /
.base-ref. GitHub now renders only a copy-to-clipboard button there,
so that element has no text, and parseReferenceRaw() threw:

TypeError: Expected `absolute` to be "user/repo:branch", got ""

This showed an error toast on PR files pages, including after using
"Discard changes" on a file, and stopped "View file" from being rebuilt
to point at the head branch.

The full reference is still available in the title attribute of the
.head-ref / .base-ref element, so fall back to it when the
sibling's text is empty. The newer React view keeps reading the
sibling as before.

Test URLs

Screenshot

image image

@fregante fregante changed the title Fix pr branch parsing actionable-pr-view-file - Restore support on older PR view Oct 20, 2026
@fregante fregante added the bug label Oct 20, 2026

@fregante fregante left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Have you tested this? Would be great to provide a screenshot if the relevant links, hovered, with the working link shown in the browser's statusbar

@JoppeDC

JoppeDC commented Oct 21, 2026

Copy link
Copy Markdown
Contributor Author

@fregante yes, i use the plugin mainly for the "discard changes" button on pr's. This was no longer working, and is working again after this fix. (The screenshot in the PR doesnt show much except that it successfully works i guess)

@JoppeDC

JoppeDC commented Oct 21, 2026

Copy link
Copy Markdown
Contributor Author

It also affects the "view file" feature. Which should open the file on the head branch instead of the branch.

As you can see on main it tries to open the commit blob on the target. Aftrer the fix it nicely opens on the source branch head again.

Main (see URL):
Screenshot 2026-10-21 at 08 05 49

After
Screenshot 2026-10-21 at 08 08 23
fix:

@fregante fregante changed the title actionable-pr-view-file - Restore support on older PR view restore - Restore support on older PR view and GHE Oct 21, 2026
@fregante fregante changed the title restore - Restore support on older PR view and GHE restore-file - Restore support on older PR view and GHE Oct 21, 2026
@fregante
fregante merged commit 3879e3c into refined-github:main Oct 21, 2026
51 checks passed
@fregante

Copy link
Copy Markdown
Member

Thank you!

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

Labels

Development

Successfully merging this pull request may close these issues.

restore-file: Expected absolute to be "user/repo:branch", got ""

2 participants