Skip to content

Commit

Permalink
Trims URL when importing a recipe (mealie-recipes#909)
Browse files Browse the repository at this point in the history
Co-authored-by: Midnight <[email protected]>
  • Loading branch information
MidnightRising and Midnight committed Jan 7, 2022
1 parent bee7a91 commit 9d9de3a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion frontend/src/components/UI/TheRecipeFab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ export default {
computed: {
recipeURL: {
set(recipe_import_url) {
recipe_import_url = recipe_import_url.trim()
this.$router.replace({ query: { ...this.$route.query, recipe_import_url } });
},
get() {
Expand Down Expand Up @@ -234,7 +235,7 @@ export default {
this.processing = false;
},
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');
},
},
Expand Down

0 comments on commit 9d9de3a

Please sign in to comment.