Compare commits

...

3 Commits

Author SHA1 Message Date
b-Nollet
c11ed381c7 better warn message, changelog 2023-12-12 17:15:41 +01:00
b-Nollet
265b545c0c logging removed values 2023-12-11 15:43:33 +01:00
b-Nollet
86ccdd8f72 fix: error stored in remote url 2023-12-08 11:48:01 +01:00
3 changed files with 19 additions and 0 deletions

View File

@@ -13,6 +13,8 @@
> Users must be able to say: “I had this issue, happy to know it's fixed” > Users must be able to say: “I had this issue, happy to know it's fixed”
- [Remotes] Prevents the "connection failed" alert from continuing to appear after successfull connection
### Packages to release ### Packages to release
> When modifying a package, add it here with its release type. > When modifying a package, add it here with its release type.
@@ -29,4 +31,6 @@
<!--packages-start--> <!--packages-start-->
- xo-remote-parser patch
<!--packages-end--> <!--packages-end-->

View File

@@ -21,6 +21,7 @@
"node": ">=6" "node": ">=6"
}, },
"dependencies": { "dependencies": {
"@xen-orchestra/log": "^0.6.0",
"lodash": "^4.13.1", "lodash": "^4.13.1",
"url-parse": "^1.4.7" "url-parse": "^1.4.7"
}, },

View File

@@ -4,6 +4,9 @@ import trim from 'lodash/trim'
import trimStart from 'lodash/trimStart' import trimStart from 'lodash/trimStart'
import queryString from 'querystring' import queryString from 'querystring'
import urlParser from 'url-parse' import urlParser from 'url-parse'
import { createLogger } from '@xen-orchestra/log'
const { warn } = createLogger('xo:xo-remote-parser')
const NFS_RE = /^([^:]+):(?:(\d+):)?([^:?]+)(\?[^?]*)?$/ const NFS_RE = /^([^:]+):(?:(\d+):)?([^:?]+)(\?[^?]*)?$/
const SMB_RE = /^([^:]+):(.+)@([^@]+)\\\\([^\0?]+)(?:\0([^?]*))?(\?[^?]*)?$/ const SMB_RE = /^([^:]+):(.+)@([^@]+)\\\\([^\0?]+)(?:\0([^?]*))?(\?[^?]*)?$/
@@ -15,6 +18,17 @@ const parseOptionList = (optionList = '') => {
optionList = optionList.substring(1) optionList = optionList.substring(1)
} }
const parsed = queryString.parse(optionList) const parsed = queryString.parse(optionList)
// bugfix for persisting error notification
if ('error' in parsed) {
warn('Deleting "error" value in url query, resave your remote to clear this values', { error: parsed.error })
delete parsed.error
}
if ('name' in parsed) {
warn('Deleting "name" value in url query, resave your remote to clear this values', { name: parsed.name })
delete parsed.name
}
Object.keys(parsed).forEach(key => { Object.keys(parsed).forEach(key => {
const val = parsed[key] const val = parsed[key]
// some incorrect values have been saved in users database (introduced by #6270) // some incorrect values have been saved in users database (introduced by #6270)