diff --git a/client/components/modals/podcast/tabs/EpisodeMatch.vue b/client/components/modals/podcast/tabs/EpisodeMatch.vue index 640ec5479e..de58bdf90a 100644 --- a/client/components/modals/podcast/tabs/EpisodeMatch.vue +++ b/client/components/modals/podcast/tabs/EpisodeMatch.vue @@ -132,7 +132,7 @@ export default { this.searchedTitle = this.episodeTitle this.isProcessing = true this.$axios - .$get(`/api/podcasts/${this.libraryItem.id}/search-episode?title=${this.$encodeUriPath(this.episodeTitle)}`) + .$get(`/api/podcasts/${this.libraryItem.id}/search-episode?title=${encodeURIComponent(this.episodeTitle)}`) .then((results) => { this.episodesFound = results.episodes.map((ep) => ep.episode) console.log('Episodes found', this.episodesFound) @@ -153,4 +153,4 @@ export default { }, mounted() {} } - \ No newline at end of file + diff --git a/client/plugins/init.client.js b/client/plugins/init.client.js index cbf514fd16..984ec9d0d7 100644 --- a/client/plugins/init.client.js +++ b/client/plugins/init.client.js @@ -6,7 +6,6 @@ import * as locale from 'date-fns/locale' Vue.directive('click-outside', vClickOutside.directive) - Vue.prototype.$setDateFnsLocale = (localeString) => { if (!locale[localeString]) return 0 return setDefaultOptions({ locale: locale[localeString] }) @@ -112,14 +111,15 @@ Vue.prototype.$sanitizeSlug = (str) => { str = str.toLowerCase() // remove accents, swap ñ for n, etc - var from = "àáäâèéëêìíïîòóöôùúüûñçěščřžýúůďťň·/,:;" - var to = "aaaaeeeeiiiioooouuuuncescrzyuudtn-----" + var from = 'àáäâèéëêìíïîòóöôùúüûñçěščřžýúůďťň·/,:;' + var to = 'aaaaeeeeiiiioooouuuuncescrzyuudtn-----' for (var i = 0, l = from.length; i < l; i++) { str = str.replace(new RegExp(from.charAt(i), 'g'), to.charAt(i)) } - str = str.replace('.', '-') // replace a dot by a dash + str = str + .replace('.', '-') // replace a dot by a dash .replace(/[^a-z0-9 -_]/g, '') // remove invalid chars .replace(/\s+/g, '-') // collapse whitespace and replace by a dash .replace(/-+/g, '-') // collapse dashes @@ -131,13 +131,16 @@ Vue.prototype.$sanitizeSlug = (str) => { Vue.prototype.$copyToClipboard = (str, ctx) => { return new Promise((resolve) => { if (navigator.clipboard) { - navigator.clipboard.writeText(str).then(() => { - if (ctx) ctx.$toast.success('Copied to clipboard') - resolve(true) - }, (err) => { - console.error('Clipboard copy failed', str, err) - resolve(false) - }) + navigator.clipboard.writeText(str).then( + () => { + if (ctx) ctx.$toast.success('Copied to clipboard') + resolve(true) + }, + (err) => { + console.error('Clipboard copy failed', str, err) + resolve(false) + } + ) } else { const el = document.createElement('textarea') el.value = str @@ -160,26 +163,18 @@ function xmlToJson(xml) { for (const res of xml.matchAll(/(?:<(\w*)(?:\s[^>]*)*>)((?:(?!<\1).)*)(?:<\/\1>)|<(\w*)(?:\s*)*\/>/gm)) { const key = res[1] || res[3] const value = res[2] && xmlToJson(res[2]) - json[key] = ((value && Object.keys(value).length) ? value : res[2]) || null - + json[key] = (value && Object.keys(value).length ? value : res[2]) || null } return json } Vue.prototype.$xmlToJson = xmlToJson -Vue.prototype.$encodeUriPath = (path) => { - return path.replace(/\\/g, '/').replace(/%/g, '%25').replace(/#/g, '%23') -} - const encode = (text) => encodeURIComponent(Buffer.from(text).toString('base64')) Vue.prototype.$encode = encode const decode = (text) => Buffer.from(decodeURIComponent(text), 'base64').toString() Vue.prototype.$decode = decode -export { - encode, - decode -} +export { encode, decode } export default ({ app, store }, inject) => { app.$decode = decode app.$encode = encode diff --git a/server/utils/podcastUtils.js b/server/utils/podcastUtils.js index bfe540edd5..92679903ba 100644 --- a/server/utils/podcastUtils.js +++ b/server/utils/podcastUtils.js @@ -289,7 +289,6 @@ module.exports.findMatchingEpisodesInFeed = (feed, searchTitle) => { const matches = [] feed.episodes.forEach((ep) => { if (!ep.title) return - const epTitle = ep.title.toLowerCase().trim() if (epTitle === searchTitle) { matches.push({