-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Show server response as error message in put saver #6589
Show server response as error message in put saver #6589
Conversation
Second commit is kind of unrelated, so let me know if you prefer it removed from this PR. |
Thanks @simonbaird looks OK to me, but it would indeed be helpful to test it with WebDAV backends. I think @pmario and @saqimtiaz have done some WebDAV experiments in the last year or two? |
I use WebDAV pretty heavily and can do some testing this week. I don't foresee any issues though. |
I'm using WebDav for some of my wikis and IIS as backend. I'll test it and report back |
57c6b79
to
5457d85
Compare
I'd like to use this on Tiddlyhost so users can get more informative error messages if the put save fails for whatever reason. This would make the put saver a viable replacement for the legacy upload saver, which is what Tiddlyhost uses currently. I'm not sure what standard WebDAV servers do, but I would guess they don't provide any response body for put requests, and hence this patch would have no impact for a standard WebDAV server. (That said, it would be a good idea to test it to make sure there aren't any unexpected regressions for WebDAV or other put saver compatible services.)
There's no need to extract it from the error string created inside tw.utils.httpRequest if we can get it directly from the xhr object.
There are two related changes here: 1. Add a 'Save starting' notification for the put saver, similar to the upload saver. Not sure if it was intentionally omitted for the put saver, but it seems reasonable to have the two be consistent. 2. Send the 'Save starting' notifications in both upload and put save right before the actual request is sent. While testing I noticed that the save might have failed before the "Save starting" notification appeared which doesn't seem useful.
5457d85
to
348de46
Compare
I added another commit to add a "Save started" notification for put saving. See commit message for details. |
TiddlyWiki's upload.js saver is old and deprecated so let's see if we can switch to using the put saver. Includes: - A bogus WebDAV header to convince TiddlyWiki that the put saver is usable - A new controller method and route for the "put" saves - Clear the url from $:/UploadURL when serving a site to make sure TW doesn't try to use the upload saver There's a related PR for TiddlyWiki that exposes the error messages to the user, see TiddlyWiki/TiddlyWiki5#6589 Issue: #148
TiddlyWiki's upload.js saver is old and deprecated so let's see if we can switch to using the put saver. Includes: - A bogus WebDAV header to convince TiddlyWiki that the put saver is usable - A new controller method and route for the "put" saves - Clear the url from $:/UploadURL when serving a site to make sure TW doesn't try to use the upload saver There's a related PR for TiddlyWiki that exposes the error messages to the user, see TiddlyWiki/TiddlyWiki5#6589 Issue: #148
TiddlyWiki's upload.js saver is old and deprecated so let's see if we can switch to using the put saver. Includes: - A bogus WebDAV header to convince TiddlyWiki that the put saver is usable - A new controller method and route for the "put" saves - Clear the url from $:/UploadURL when serving a site to make sure TW doesn't try to use the upload saver There's a related PR for TiddlyWiki that exposes the error messages to the user, see TiddlyWiki/TiddlyWiki5#6589 Issue: #148
I can confirm that a response to a PUT request from a WebDAV server has no response body for a successful request. A bit trickier to recreate error conditions, but will have another look later in the week. |
Thanks everyone I think that we can merge this now, but obviously further testing is welcome. |
TiddlyWiki's upload.js saver is old and deprecated so let's see if we can switch to using the put saver. Includes: - A bogus WebDAV header to convince TiddlyWiki that the put saver is usable - A new controller method and route for the "put" saves - Clear the url from $:/UploadURL when serving a site to make sure TW doesn't try to use the upload saver There's a related PR for TiddlyWiki that exposes the error messages to the user, see TiddlyWiki/TiddlyWiki5#6589 Issue: #148
TiddlyWiki's upload.js saver is old and deprecated so let's see if we can switch to using the put saver. Includes: - A bogus WebDAV header to convince TiddlyWiki that the put saver is usable - A new controller method and route for the "put" saves - Clear the url from $:/UploadURL when serving a site to make sure TW doesn't try to use the upload saver There's a related PR for TiddlyWiki that exposes the error messages to the user, see TiddlyWiki/TiddlyWiki5#6589 Issue: #148
Thanks all! If you want to see this in action on Tiddlyhost, follow the steps here. |
TiddlyWiki's upload.js saver is old and deprecated so let's see if we can switch to using the put saver. Includes: - A bogus WebDAV header to convince TiddlyWiki that the put saver is usable - A new controller method and route for the "put" saves - Clear the url from $:/UploadURL when serving a site to make sure TW doesn't try to use the upload saver There's a related PR for TiddlyWiki that exposes the error messages to the user, see TiddlyWiki/TiddlyWiki5#6589 Issue: #148
TiddlyWiki's upload.js saver is old and deprecated so let's see if we can switch to using the put saver. Includes: - A bogus WebDAV header to convince TiddlyWiki that the put saver is usable - A new controller method and route for the "put" saves - Clear the url from $:/UploadURL when serving a site to make sure TW doesn't try to use the upload saver There's a related PR for TiddlyWiki that exposes the error messages to the user, see TiddlyWiki/TiddlyWiki5#6589 Issue: #148
TiddlyWiki's upload.js saver is old and deprecated so let's see if we can switch to using the put saver. Includes: - A bogus WebDAV header to convince TiddlyWiki that the put saver is usable - A new controller method and route for the "put" saves - Clear the url from $:/UploadURL when serving a site to make sure TW doesn't try to use the upload saver There's a related PR for TiddlyWiki that exposes the error messages to the user, see TiddlyWiki/TiddlyWiki5#6589 Issue: #148
TiddlyWiki's upload.js saver is old and deprecated so let's see if we can switch to using the put saver. Includes: - A bogus WebDAV header to convince TiddlyWiki that the put saver is usable - A new controller method and route for the "put" saves - Clear the url from $:/UploadURL when serving a site to make sure TW doesn't try to use the upload saver There's a related PR for TiddlyWiki that exposes the error messages to the user, see TiddlyWiki/TiddlyWiki5#6589 Issue: #148
I'd like to use this on Tiddlyhost so users can get more informative error messages if the put save fails for whatever reason.
This would make the put saver a viable replacement for the legacy upload saver, which is what Tiddlyhost uses currently.
I'm not sure what standard WebDAV servers do, but I would guess they don't provide any response body for put requests, and hence this patch would have no impact for a standard WebDAV server.
(That said, it would be a good idea to test it to make sure there aren't any unexpected regressions for WebDAV or other put saver compatible services.)
Also includes two related small tweaks. See commit messages for details.