[openstreetmap/openstreetmap-website] Image download w/ submit_tag (PR #6192)
mmd
notifications at github.com
Tue Jul 15 18:21:21 UTC 2025
mmd-osm left a comment (openstreetmap/openstreetmap-website#6192)
So the button is set to disabled in the setTimeout function below.
```javascript
$document.on('submit.rails', rails.formSubmitSelector, function(e) {
var form = $(this),
remote = rails.isRemote(form),
blankRequiredInputs,
nonBlankFileInputs;
[...]
} else {
// Slight timeout so that the submit button gets properly serialized
setTimeout(function(){ rails.disableFormElements(form); }, 13); // <<<<<
}
});
```
Re-enabling the button would work, if we were to use ajax:
```javascript
$document.on('ajax:complete.rails', rails.formSubmitSelector, function(event) {
if (this === event.target) rails.enableFormElements($(this));
});
```
However, in this scenario, it's a plain HTTP POST, followed by a 302 response and another HTTP GET on render.openstreetmap.org.
This event simply never fires, because it's not a "remote" call. The source code mentions a "data-remote" attribute to send the request as AJAX.
However, CSP doesn't allow render.openstreetmap.org, the render site isn't properly handling CORS preflight requests, and the required totp cookie would be lost as well.
Long story short, I don't see much alternatives at the moment to implement this.
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/6192#issuecomment-3074886052
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/6192/c3074886052 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20250715/4c472bb7/attachment.htm>
More information about the rails-dev
mailing list