diff options
author | Amine Mouafik <amine@mouafik.fr> | 2020-02-11 00:39:07 +0100 |
---|---|---|
committer | Amine Mouafik <amine@mouafik.fr> | 2020-02-11 00:39:07 +0100 |
commit | a8781e825378cd9583dfae8750c7a5d1a4fdbe1c (patch) | |
tree | a3dfa5c832ca79e44588f3e860256f4f003c5532 | |
parent | Upgrade normalize-url to latest major (diff) | |
download | ferdium-app-a8781e825378cd9583dfae8750c7a5d1a4fdbe1c.tar.gz ferdium-app-a8781e825378cd9583dfae8750c7a5d1a4fdbe1c.tar.zst ferdium-app-a8781e825378cd9583dfae8750c7a5d1a4fdbe1c.zip |
#276 Fix custom URL validation failing due to URL normalization
-rw-r--r-- | src/components/settings/services/EditServiceForm.js | 2 | ||||
m--------- | src/internal-server | 0 | ||||
-rw-r--r-- | src/models/Service.js | 6 |
3 files changed, 4 insertions, 4 deletions
diff --git a/src/components/settings/services/EditServiceForm.js b/src/components/settings/services/EditServiceForm.js index fa34ac60b..89c82c7f8 100644 --- a/src/components/settings/services/EditServiceForm.js +++ b/src/components/settings/services/EditServiceForm.js | |||
@@ -169,7 +169,7 @@ export default @observer class EditServiceForm extends Component { | |||
169 | if (recipe.validateUrl && values.customUrl) { | 169 | if (recipe.validateUrl && values.customUrl) { |
170 | this.setState({ isValidatingCustomUrl: true }); | 170 | this.setState({ isValidatingCustomUrl: true }); |
171 | try { | 171 | try { |
172 | values.customUrl = normalizeUrl(values.customUrl, { stripWWW: false }); | 172 | values.customUrl = normalizeUrl(values.customUrl, { stripWWW: false, removeTrailingSlash: false }); |
173 | isValid = await recipe.validateUrl(values.customUrl); | 173 | isValid = await recipe.validateUrl(values.customUrl); |
174 | } catch (err) { | 174 | } catch (err) { |
175 | console.warn('ValidateURL', err); | 175 | console.warn('ValidateURL', err); |
diff --git a/src/internal-server b/src/internal-server | |||
Subproject 65d1468901b7394c95e510c5aed1a23c22f0f71 | Subproject 48cb16fefe46ab66b1884f18e04c1f701a8e0c0 | ||
diff --git a/src/models/Service.js b/src/models/Service.js index 10b54602f..12a2d4af9 100644 --- a/src/models/Service.js +++ b/src/models/Service.js | |||
@@ -1,6 +1,6 @@ | |||
1 | import { computed, observable, autorun } from 'mobx'; | 1 | import { autorun, computed, observable } from 'mobx'; |
2 | import path from 'path'; | ||
3 | import normalizeUrl from 'normalize-url'; | 2 | import normalizeUrl from 'normalize-url'; |
3 | import path from 'path'; | ||
4 | 4 | ||
5 | const debug = require('debug')('Ferdi:Service'); | 5 | const debug = require('debug')('Ferdi:Service'); |
6 | 6 | ||
@@ -146,7 +146,7 @@ export default class Service { | |||
146 | if (this.recipe.hasCustomUrl && this.customUrl) { | 146 | if (this.recipe.hasCustomUrl && this.customUrl) { |
147 | let url; | 147 | let url; |
148 | try { | 148 | try { |
149 | url = normalizeUrl(this.customUrl, { stripWWW: false }); | 149 | url = normalizeUrl(this.customUrl, { stripWWW: false, removeTrailingSlash: false }); |
150 | } catch (err) { | 150 | } catch (err) { |
151 | console.error(`Service (${this.recipe.name}): '${this.customUrl}' is not a valid Url.`); | 151 | console.error(`Service (${this.recipe.name}): '${this.customUrl}' is not a valid Url.`); |
152 | } | 152 | } |