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
Parsing a .json configuration for WebDAV does not work #3619
Comments
At least in 2.0.4.5, the JSON records it: { |
Closing this as we cannot reproduce this. My guess is that the JSON was created with a version that didn't properly escape certain characters, and that issue has since been resolved. |
This issue has been mentioned on Duplicati. There might be relevant details there: https://forum.duplicati.com/t/importing-config-file-mixes-up-fields/10489/2 |
Importing config file mixes up fields confirms the varying export behavior (so varying import bug) that I found when I looked at this:
is issue workaround, however I suspect the reason @warwickmm could not reproduce this is due to either not exporting passwords, or not setting a password to export (which is, oddly, sort of what the screenshots asked for). So problem being seen seems two-part. On import part, an @ sign is mishandled (even in manual edit test above). On export part, it is typically possible to export an @ sign. I propose this issue be opened. |
Thanks @ts678. I can reproduce this now. It seems the key step is to not export passwords for a configuration that has passwords. So far, my debugging the problem with import is pointing to the issue lying in the javascript code. The C# code appears to be deserialzing the JSON properly, and the target URL appears ok. The problem might lie in how the various components are extracted from the target URL. Also, we should probably fix export so that all paths use the same encoding (in this case, |
My suspicion is this regex
and the function that follows it. |
It seems that when passwords are not exported, Backup.SanitizeTargetUrl is called. When passwords are exported, this method is not called. |
Revision c41f2c6 from pull request #3467 appears to be the cause of |
In revision c41f2c6 ("moved all sanitization logic into backup class and moved from regex to using internal Uri library"), we cleaned up the removal of passwords from an exported backup configuration. However, the use of Uri.QueryParameters resulted in exporting decoded parameter values, which violated some assumptions made by the decode_uri function in AppUtils.js. This caused usernames in the JSON to contain '@' instead of '%40', which led to incorrect decomposition of the target URL into its components in the UI. This concerns issue duplicati#3619.
This tests that we escape '@' with '%40', as the import code in escape_uri in AppUtils.js cannot handle '@'. This concerns issue duplicati#3619.
In revision c41f2c6 ("moved all sanitization logic into backup class and moved from regex to using internal Uri library"), we cleaned up the removal of passwords from an exported backup configuration. However, the use of Uri.QueryParameters resulted in exporting decoded parameter values, which violated some assumptions made by the decode_uri function in AppUtils.js. This caused usernames in the JSON to contain '@' instead of '%40', which led to incorrect decomposition of the target URL into its components in the UI. This concerns issue duplicati#3619.
This tests that we escape '@' with '%40', as the import code in escape_uri in AppUtils.js cannot handle '@'. This concerns issue duplicati#3619.
Pull request #4293 should fix the problem where export sometimes uses |
Environment info
Description
I tried to configure a backup by using a .json config file that I saved before.
The re-configuration from this .json file failed.
Steps to reproduce
Actual result:
The relevant line in the .json is probably:
"TargetURL": "webdavs://sd2dav.1und1.de/Duplicati_Test1?auth-username=xxxxxxxxxxx@online.de"
The setting that were parsed from this line for the WebDAV backend were mixed up:
Server and Port: online.de /
Path on Server:
Username: sd2dav.1und1.de/Duplicati_Test1?auth-username=xxxxxxxxxxx
Expected result:
Server and Port: sd2dav.1und1.de
Path on Server: Duplicati_Test1
Username: xxxxxxxxxxx@online.de
Screenshots
Debug log
The text was updated successfully, but these errors were encountered: