mirror of
https://github.com/go-gitea/gitea.git
synced 2026-03-16 21:23:02 -05:00
Browsers without SubmitEvent.submitter support don't work with form-fetch-action mechanism well #12136
Closed
opened 2025-11-02 09:59:32 -06:00 by GiteaMirror
·
37 comments
No Branch/Tag Specified
main
release/v1.25
release/v1.24
release/v1.23
release/v1.22
release/v1.21
release/v1.20
release/v1.19
release/v1.18
release/v1.17
release/v1.16
release/v1.15
release/v1.14
release/v1.13
release/v1.12
release/v1.11
release/v1.10
release/v1.9
release/v1.8
v1.25.3
v1.25.2
v1.25.1
v1.25.0
v1.24.7
v1.25.0-rc0
v1.26.0-dev
v1.24.6
v1.24.5
v1.24.4
v1.24.3
v1.24.2
v1.24.1
v1.24.0
v1.23.8
v1.24.0-rc0
v1.25.0-dev
v1.23.7
v1.23.6
v1.23.5
v1.23.4
v1.23.3
v1.23.2
v1.23.1
v1.23.0
v1.23.0-rc0
v1.24.0-dev
v1.22.6
v1.22.5
v1.22.4
v1.22.3
v1.22.2
v1.22.1
v1.22.0
v1.23.0-dev
v1.22.0-rc1
v1.21.11
v1.22.0-rc0
v1.21.10
v1.21.9
v1.21.8
v1.21.7
v1.21.6
v1.21.5
v1.21.4
v1.21.3
v1.21.2
v1.20.6
v1.21.1
v1.21.0
v1.21.0-rc2
v1.21.0-rc1
v1.20.5
v1.22.0-dev
v1.21.0-rc0
v1.20.4
v1.20.3
v1.20.2
v1.20.1
v1.20.0
v1.19.4
v1.21.0-dev
v1.20.0-rc2
v1.20.0-rc1
v1.20.0-rc0
v1.19.3
v1.19.2
v1.19.1
v1.19.0
v1.19.0-rc1
v1.20.0-dev
v1.19.0-rc0
v1.18.5
v1.18.4
v1.18.3
v1.18.2
v1.18.1
v1.18.0
v1.17.4
v1.18.0-rc1
v1.19.0-dev
v1.18.0-rc0
v1.17.3
v1.17.2
v1.17.1
v1.17.0
v1.17.0-rc2
v1.16.9
v1.17.0-rc1
v1.18.0-dev
v1.16.8
v1.16.7
v1.16.6
v1.16.5
v1.16.4
v1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rc2
v1.3.3
v1.4.0-rc1
v1.3.2
v1.3.1
v1.3.0
v1.3.0-rc2
v1.3.0-rc1
v1.2.3
v1.2.2
v1.2.1
v1.2.0
v1.2.0-rc3
v1.2.0-rc2
v1.1.4
v1.2.0-rc1
v1.1.3
v1.1.2
v1.1.1
v1.1.0
v1.0.2
v1.0.1
v1.0.0
v0.9.99
Labels
Clear labels
$20
$250
$50
$500
backport/done
💎 Bounty
docs-update-needed
good first issue
hacktoberfest
issue/bounty
issue/confirmed
issue/critical
issue/duplicate
issue/needs-feedback
issue/not-a-bug
issue/regression
issue/stale
issue/workaround
lgtm/need 2
modifies/api
modifies/translation
outdated/backport/v1.18
outdated/theme/markdown
outdated/theme/timetracker
performance/bigrepo
performance/cpu
performance/memory
performance/speed
pr/breaking
proposal/accepted
proposal/rejected
pr/wip
pull-request
reviewed/wontfix
💰 Rewarded
skip-changelog
status/blocked
topic/accessibility
topic/api
topic/authentication
topic/build
topic/code-linting
topic/commit-signing
topic/content-rendering
topic/deployment
topic/distribution
topic/federation
topic/gitea-actions
topic/issues
topic/lfs
topic/mobile
topic/moderation
topic/packages
topic/pr
topic/projects
topic/repo
topic/repo-migration
topic/security
topic/theme
topic/ui
topic/ui-interaction
topic/ux
topic/webhooks
topic/wiki
type/bug
type/deprecation
type/docs
type/enhancement
type/feature
type/miscellaneous
type/proposal
type/question
type/refactoring
type/summary
type/testing
type/upstream
Mirrored from GitHub Pull Request
No Label
issue/needs-feedback
Milestone
No items
No Milestone
Projects
Clear projects
No project
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/gitea#12136
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @wolfbeast on GitHub (Dec 1, 2023).
Description
I recently updated to 1.21.0 and am running into an issue now that I cannot close or re-open pull requests from the discussion page buttons at the bottom (neither with or without comment). I did not have this issue on our last version (1.19.4).
I am still able to open and close pull requests from the pull request listing (checking the boxes then clicking the close button).
I have not seen any error message be thrown in the UI.
Gitea Version
1.21.0
Can you reproduce the bug on the Gitea demo site?
Yes
Log Gist
No response
Screenshots
Git Version
No response
Operating System
CentOS 7
How are you running Gitea?
Binary download from gitea distr. natively installed (command-line/service)
Database
MySQL/MariaDB
@lng2020 commented on GitHub (Dec 4, 2023):
What do you mean by
Doesn't work? You can't click on it, or after clicking on it, nothing changes.@wolfbeast commented on GitHub (Dec 6, 2023):
Sorry if I wasn't clear. I can click on it, the page refreshes, but nothing changes in the status of the pull request.
@ghost commented on GitHub (Dec 11, 2023):
I'm having the same/similar issue. It's a Draft PR with one dependency.
Tried closing via the PR listing, but then it says
This seems backwards, a dependency should not prevent me from closing the PR.
@wolfbeast commented on GitHub (Dec 11, 2023):
I don't think that's related. This issue occurs for me regardless of dependencies and does not throw any errors. It just reloads the page (as if the command would be processed) but the status of the PR does not change, no error given.
@wxiaoguang commented on GitHub (Dec 11, 2023):
Quote your issue:
How to?
@wolfbeast commented on GitHub (Dec 12, 2023):
@wxiaoguang commented on GitHub (Dec 12, 2023):
On try.gitea.io https://try.gitea.io/wxiaoguang/test/pulls/35
1 & 2: edit a file in a repo on a separate branch, create a PR from the branch comparison
Everything seems fine.
@wolfbeast commented on GitHub (Dec 12, 2023):
I'm actually seeing the same simply with an open issue. can't close it with the button. I'll see if I can get a log.
@wxiaoguang commented on GitHub (Dec 12, 2023):
Double confirm: are you sure you can reproduce it on try.gitea.io? If yes, is it browser related? If no, is it custom-template related?
@wolfbeast commented on GitHub (Dec 12, 2023):
I can't see anything in our gitea log. Nothing in the browser console either. no errors on the page.
The behavior when checking the network request seems to be the following:
redirect:to the issue/pr URL./-/fetch-redirectURL.with further loading of the page
has anything in that respect changed since 1.19?
@wolfbeast commented on GitHub (Dec 12, 2023):
Yes absolutely. i just tested and verified. created a new issue, tried to close it. nada.
@wolfbeast commented on GitHub (Dec 12, 2023):
OK, seems Blink-based browsers have no problem (tested with edge and it works), so there may be something specific interop-wise with Pale Moon as a browser.
EDIT: verified it's not a regression in Pale Moon as an older installation displays the exact same behaviour on the test instance.
@wxiaoguang commented on GitHub (Dec 12, 2023):
I think it's related to this one: https://github.com/go-gitea/gitea/pull/25258
@wolfbeast commented on GitHub (Dec 12, 2023):
Looks like that might be the problem yes. Clearly there are some issues depending on browser implementations in use as the fetch spec is pretty ambiguous when it comes to CORS, preflight and redirects and it's not guaranteed to work. You may want to revert that.
@wxiaoguang commented on GitHub (Dec 12, 2023):
Sorry I didn't see it ever used any CORS/pre-flight/fetch-redirects (the
/-/fetch-redirectis a traditional POST FORM request to help to redirect, no JS fetch redirect)See the requests from Firefox:
Everything there is using standard browser implementations. I don't see anything tricky. Any modern browser should work well with it.
That change benefits a lot and is the future. I do not see any reason to revert.
@wolfbeast commented on GitHub (Dec 12, 2023):
I was assuming it was a fetch-redirect based on the response names. Please let me know exactly what requests you're making if you're convinced this is a web client issue. note that "standard browser implementations" in general means "Blink" but not everyone is using Blink.
Well as far as I know Goanna/UXP/Pale Moon is following the Fetch spec correctly! This is a problem as we do use gitea for our code development. If there is an issue with the implementation of Fetch in Pale Moon then please tell me what is wrong with it, as Gitea is literally the only WebUI where this problem seems to occur. Fetch is used everywhere and there have not been any reports otherwise. What exactly are the fetch API calls used here?
@wolfbeast commented on GitHub (Dec 12, 2023):
FTR, here are the network requests in Pale Moon.

It seems to be exactly the same as Firefox you posted.
@wxiaoguang commented on GitHub (Dec 12, 2023):
About
/-/fetch-redirect:About: note that "standard browser implementations" in general means "Blink" but not everyone is using Blink.
I think the Gitea code is also using Fetch spec correctly, and Gitea also has been using
fetchwidely for long time.So, maybe the problem is not directly related to
fetch. You could compare the requests and responses line by line to see the difference.@wxiaoguang commented on GitHub (Dec 12, 2023):
I tested with PaleMoon, the problem is that PaleMoon doesn't send the expected form content:
The left one is firefox, the right one is palemoon
@wxiaoguang commented on GitHub (Dec 12, 2023):
I think the root problem is here. PaleMoon doesn't support "SubmitEvent.submitter"
@wolfbeast commented on GitHub (Dec 12, 2023):
Pale Moon does NOT use Gecko. It is forked from Gecko and has been independently developed for the last decade.
Gecko in 2023 is pretty much equal to Blink because Google pays their bills to be the controlled "second vote" for any spec requests.
I looked at your quoted code, and noticed the lines you pointed out do not include the "status" attribute for the form submitted. I don't see how that is being transferred to Gitea:
You synthesize a new form with "redirect:" and nothing else, so it would make sense that "status" isn't part of that submitted form...
How are you handling the form submission code, exactly? maybe this has less to do with the fetch redirect and more to do with submission. Are you triggering it from JS and if so, how?
@wxiaoguang commented on GitHub (Dec 12, 2023):
They are really not related. See my comment above, the problem is PaleMoon lacks
SubmitEvent.submittersupport.The
statuskey/value should come fromSubmitEvent.submitterwhen you click the "Close" or "Reopen" button.@wolfbeast commented on GitHub (Dec 12, 2023):
Ah. that would do it, yes. We don't have the SubmitEvent interface at all, I think.
I can see about implementing that... but that won't be short term. Could you perhaps implement a workaround in Gitea in the interim?
EDIT: This by the way underlines the problem using ?. everywhere -- any errors get silenced.
@wxiaoguang commented on GitHub (Dec 12, 2023):
TBH, I don't know how to polyfill it .... how could the JS code know the real "submitter"? The low-level logic is:
@wxiaoguang commented on GitHub (Dec 12, 2023):
I think it is the correct usage of
?.because thesubmittercould be null in many cases IIRC. See the MDN: https://developer.mozilla.org/en-US/docs/Web/API/SubmitEvent/submitterIf the submission was not triggered by a button of some kind, the value of submitter is null.@wolfbeast commented on GitHub (Dec 12, 2023):
I don't understand how that could be a valid scenario here. Your action is linked exclusively to a button, no?
Anyway that's not really relevant to this issue.
I've made a priority issue to get this implemented now since you say you don't know how to pass values to the form submission otherwise and don't want to use normal form submission and this is literally breaking our devops (and reverting gitea isn't really an option anymore since we've worked several weeks in 1.21 already). I hope there won't be any big hurdles porting this code :/
@wxiaoguang commented on GitHub (Dec 12, 2023):
The form could also be submitted by: JS code, Enter, etc. So in many cases
submittercould be null, the framework should tolerate (work with) these cases, they are valid cases.Because tradition POST FORM causes too many problem (duplicate content, content lost, etc). You can take a look at these related issues/PRs.
For myself, I also agree (and am doing my best) to keep compatibility. For this case, I already checked the MDN, it shows that all recent browsers have supported such feature for long time. I couldn't figure out which feature works with PaleMoon while which don't ahead ......
@wolfbeast commented on GitHub (Dec 12, 2023):
Hey I fully understand. The problem is that many specs these days are moving targets created almost exclusively by Google who benefit greatly from an implementation-first ecosystem, and we're often explicitly not included in any spec discussions or notifications (because we apparently pissed off the wrong people by existing independently, and Mozilla apparently hates us and has tried their best to cancel us -- including defamatory statements by Mozilla employees in official Mozilla chatrooms) so we can get blindsided by the sudden use of a less well-known addition that has had almost zero documentation or implementation notes attached (like this one). We're a small team, the whole of web specs is obscenely large, and have to be reactive as a result.
Conversely, the interesting part is that if something works on Pale Moon, it's pretty much guaranteed to work everywhere because we stick to established standards where we can.
I absolutely understand you're doing your best as well to stay compatible as broadly as possible, and that the previous method apparently caused issues for you (although we've never seen problems with duplicate or lost content in Gitea from Pale Moon...) so we're having to find a way around it. I just recapped the situation; it wasn't a complaint so please don't see it that way.
@wxiaoguang commented on GitHub (Dec 12, 2023):
I've managed to find a tricky approach to polyfill.
Try "Polyfill SubmitEvent for PaleMoon #28441"
It's not perfect because it doesn't work well with "focus", while I guess most people used to click/touch the buttons on the UI 🤣
@wolfbeast commented on GitHub (Dec 12, 2023):
Thanks for trying to polyfill! So far Ive not had much luck porting stuff across on our end so it's probably going to be tricky because of our divergence from Gecko.
I'm sorry but I don't how I could try that. I know nothing about Go...
@delvh commented on GitHub (Dec 12, 2023):
You don't need to know anything about it to test it.
Install Go and npm, and the rest is
@wolfbeast commented on GitHub (Dec 13, 2023):
Thanks for the pointers.
After struggling a little through installing from source (needing gcc (for CGO_ENABLED=1) for sqlite and all that jazz...) I can confirm that the 28441 branch works properly for closing/reopening issues from the comments page! 💙
@wolfbeast commented on GitHub (Dec 15, 2023):
Thanks for the quick turnaround here! I'm assuming this will be uplifted to 1.21.3? what's the planned release date for that?
@wxiaoguang commented on GitHub (Dec 16, 2023):
You can use the nightly build.
@techknowlogick Would you like to use "1.21-nightly" for the directory name? Then it doesn't need to explain again and again, and the FAQ can be removed.
https://docs.gitea.com/help/faq?_highlight=nightly#difference-between-1x-and-1xx-downloads-how-can-i-get-latest-stable-release-with-bug-fixes
@wolfbeast commented on GitHub (Dec 16, 2023):
Okay got it. I wasn't aware that "1.21" was "1.21-release-nightly". I generally don't want to run nightly builds on production but this is of course an exception. I'll update to 1.21.3 when it's out in due course.
@delvh commented on GitHub (Dec 16, 2023):
Good news. That'll be soon.
@wxiaoguang commented on GitHub (Dec 17, 2023):
I just don't want to repeat that "1.21 is 1.21-nightly" again and again, it confuses many users.
There is no difference for stability between 1.21-nighty and 1.21.3. Actually, 1.21-nightly will become 1.21.3.