-
Notifications
You must be signed in to change notification settings - Fork 2
Description
Short description of the issue
Both these files use vanilla JS ajax requests, and even though they send:
xhr.setRequestHeader("X-REQUESTED-WITH", 'XMLHttpRequest');
they don't make use of:
xhr.getAllResponseHeaders();
This isn't an issue for the PW core, but it's a problem for the TracyDebugger module. Without the xhr.getAllResponseHeaders();
, it can't update its AJAX debug bar. This is a particular problem when debugging image/file uploads because Tracy still manages to intercept any returned notices/warnings, but it can't display them which makes it look like everything is working successfully while Tracy is running. As soon as Tracy isn't running, the notice/warning gets through with the json response and breaks the upload.
Optional: Suggestion for a possible fix
It's a very easy fix. Simply add:
xhr.getAllResponseHeaders();
after this line: https://github.com/processwire/processwire/blob/e12095e622555fe79cd792dea1ed7d671e37d9d4/wire/modules/Inputfield/InputfieldFile/InputfieldFile.js#L254
and also after this line:
https://github.com/processwire/processwire/blob/e12095e622555fe79cd792dea1ed7d671e37d9d4/wire/modules/Inputfield/InputfieldImage/InputfieldImage.js#L1402
I have tested these additions and they work perfectly.
If you want to do some more reading on the issue:
nette/tracy#233
https://processwire.com/talk/topic/4865-custom-upload-names/?do=findComment&comment=130578
It would be extremely helpful is these could be added - I think a lot of PW users have Tracy installed and this can make debugging image/file uploads problematic.
Just a final FYI - the rest of the PW core uses jquery for AJAX uploads which makes use of xhr.getAllResponseHeaders();
already, so these files are the only places this should be needed.
Thanks for considering!