Fix:Sanitize new podcast folder names and ensure feedUrl is in feed metadata #589

This commit is contained in:
advplyr 2022-05-13 17:13:58 -05:00
parent 578a946ca5
commit 113026ce13
4 changed files with 17 additions and 5 deletions

View file

@ -151,7 +151,7 @@ export default {
this.fullPath = ''
return
}
this.fullPath = Path.join(this.selectedFolderPath, this.podcast.title)
this.fullPath = Path.join(this.selectedFolderPath, this.$sanitizeFilename(this.podcast.title))
},
submit() {
const podcastPayload = {

View file

@ -114,10 +114,11 @@ Vue.prototype.$calculateTextSize = (text, styles = {}) => {
}
}
Vue.prototype.$sanitizeFilename = (input, replacement = '') => {
Vue.prototype.$sanitizeFilename = (input, colonReplacement = ' - ') => {
if (typeof input !== 'string') {
return false
}
var replacement = ''
var illegalRe = /[\/\?<>\\:\*\|"]/g;
var controlRe = /[\x00-\x1f\x80-\x9f]/g;
var reservedRe = /^\.+$/;
@ -125,6 +126,7 @@ Vue.prototype.$sanitizeFilename = (input, replacement = '') => {
var windowsTrailingRe = /[\. ]+$/;
var sanitized = input
.replace(':', colonReplacement) // Replace first occurrence of a colon
.replace(illegalRe, replacement)
.replace(controlRe, replacement)
.replace(reservedRe, replacement)