mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-07-09 03:04:54 -04:00
Trims URL when importing a recipe (#909)
Co-authored-by: Midnight <midnight1@protonmail.com>
This commit is contained in:
parent
bee7a910b7
commit
9d9de3aa77
@ -177,6 +177,7 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
recipeURL: {
|
recipeURL: {
|
||||||
set(recipe_import_url) {
|
set(recipe_import_url) {
|
||||||
|
recipe_import_url = recipe_import_url.trim()
|
||||||
this.$router.replace({ query: { ...this.$route.query, recipe_import_url } });
|
this.$router.replace({ query: { ...this.$route.query, recipe_import_url } });
|
||||||
},
|
},
|
||||||
get() {
|
get() {
|
||||||
@ -234,7 +235,7 @@ export default {
|
|||||||
this.processing = false;
|
this.processing = false;
|
||||||
},
|
},
|
||||||
isValidWebUrl(url) {
|
isValidWebUrl(url) {
|
||||||
let regEx = /^https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,256}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)$/gm;
|
let regEx = /^\s*https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,256}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)\s*$/gm;
|
||||||
return regEx.test(url) ? true : this.$t('new-recipe.must-be-a-valid-url');
|
return regEx.test(url) ? true : this.$t('new-recipe.must-be-a-valid-url');
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user