Skip to content

restore-file does not work in firefox #5690

Closed

Description

@staabm

Please ensure:

  • The bug is caused by Refined GitHub. It doesn't happen if I disable the extension.
  • The bug happens after clearing extension cache. The "Clear cache" button below can also be found at the bottom of the options page.

Example URLs

redaxo/core#5153

Extension version

22.5.22

Browser(s) used

firefox 103a

Description

I am using refined github on a lot of machines successfully, with a personal token configured.

no matter on which workstation I try, the 'restore file' action from a Pull Request 'Files changed tab' runs into "unprocessible entity" error.

repro

  • open a PR you own in Firefox
  • open 'Files changed tab'
  • click "..." from one of the PRs files
  • select 'restore file'

expected

  • toast message "restoring..."
  • toast message "committing..."
  • toast message "success"

actual:

  • toast message "restoring..."
  • toast message "committing..."
  • toast message "unprocessible entity" ❌

the error happens on any file I pick of any PR I have submitted

I am using this feature successfully in chrome on the very same pull requests and the very same machine.
I can reproduce the error on macOS and windows11.

Include in this issue:

  • Screenshots/video/gif demonstrating the bug, if it’s visual
  • Console errors, if any

Activity

  1. staabm commented on Jun 11, 2022

    @staabm
    Author

    the feature did never work for me in Firefox (its not a recent regression)

  2. added
    firefox
    on Jun 11, 2022
  3. fregante commented on Jun 15, 2022

    @fregante
    Member

    It works for me

    Screen.Recording.mov

    Does update-pr-from-base-branch work for you? Just to exclude some API/token errors.

    Also it'd be good to see:

    • any console errors
    • the full HTTP response from the Network tab in the developer tools
  4. changed the title [-]'restore file' does not work in firefox[/-] [+]`restore-file` does not work in firefox[/+] on Jun 15, 2022
  5. fregante commented on Jun 15, 2022

    @fregante
    Member

    Also:

    It appears to be failing here:

    const response = await pushForm(form);
    if (!response.ok) {
    throw new Error(response.statusText);
    }

    Also related:

    // `content.fetch` is Firefox’s way to make fetches from the page instead of from a different context
    // This will set the correct `origin` header without having to use XMLHttpRequest
    // https://stackoverflow.com/questions/47356375/firefox-fetch-api-how-to-omit-the-origin-header-in-the-request
    // https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Content_scripts#XHR_and_Fetch
    pushForm.fetch = window.content?.fetch ?? window.fetch;

  6. added a commit that references this issue on Jun 17, 2022
  7. staabm commented on Jun 17, 2022

    @staabm
    Author

    thanks for your investigation.

    Does update-pr-from-base-branch work for you? Just to exclude some API/token errors.

    yep, works for me. using it several times a day.

    • any console errors

    grafik

    Stacktrace

    restoreFile@moz-extension://01871e10-e970-4233-b25d-039f9c0d0989/refined-github.js:8815:31
    async*handleRestoreFileClick/<@moz-extension://01871e10-e970-4233-b25d-039f9c0d0989/refined-github.js:8824:57
    showToast@moz-extension://01871e10-e970-4233-b25d-039f9c0d0989/refined-github.js:7930:15
    async*handleRestoreFileClick@moz-extension://01871e10-e970-4233-b25d-039f9c0d0989/refined-github.js:8824:17
    listenerFn@moz-extension://01871e10-e970-4233-b25d-039f9c0d0989/refined-github.js:2635:76
    EventListener.handleEvent*delegate@moz-extension://01871e10-e970-4233-b25d-039f9c0d0989/refined-github.js:2645:74
    init@moz-extension://01871e10-e970-4233-b25d-039f9c0d0989/refined-github.js:8848:128
    runFeature@moz-extension://01871e10-e970-4233-b25d-039f9c0d0989/refined-github.js:3913:26
    setupPageLoad@moz-extension://01871e10-e970-4233-b25d-039f9c0d0989/refined-github.js:3921:40
    add/<@moz-extension://01871e10-e970-4233-b25d-039f9c0d0989/refined-github.js:3946:35
    async*add@moz-extension://01871e10-e970-4233-b25d-039f9c0d0989/refined-github.js:3947:11
    async*@moz-extension://01871e10-e970-4233-b25d-039f9c0d0989/refined-github.js:8844:16
    @moz-extension://01871e10-e970-4233-b25d-039f9c0d0989/refined-github.js:11398:5
    @moz-extension://01871e10-e970-4233-b25d-039f9c0d0989/refined-github.js:11399:3
    
    • the full HTTP response from the Network tab in the developer tools

    I can't see any http requets after pushing 'restore'

    open a PR on refined-github/sandbox and try there, to exclude repo-related issues

    I can reproduce the issue on this repo in refined-github/sandbox#17

    are you using any HTTP-related blocker/extension?

    I have a few brower extensions. I just disabled all but refined github.

    the error still reproduces

  8. fregante commented on Jul 22, 2022

    @fregante
    Member

    I'd like to fix this or else it's likely that this issue will just stay open forever.

    Can you try again and copy the "unprocessable entity" request from the developer tools "as cURL"? Just ensure to remove or break the token before pasting it here. I want to see how it compares to a request that is accepted.

    Also include the file you're trying to restore (make sure you try this on a small file because it will be part of the cURL)

  9. staabm commented on Jul 22, 2022

    @staabm
    Author

    hmm I can no longer reproduce on the sandbox repo with refined-github/sandbox#26

    did another test on redaxo/core#5261 and it also works.

    not sure why it started working and when!? 🤷

    I was able to reproduce this issue for months and now it seems no longer appear?

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    acceptedbugfirefox

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions