trim spaces from short_name, otherwise recipes become unnavigatable if ending on spaces
This commit is contained in:
		@@ -110,7 +110,7 @@
 | 
				
			|||||||
					...add_info,
 | 
										...add_info,
 | 
				
			||||||
					images: {mediapath: short_name + '.webp', alt: "", caption: ""}, // TODO
 | 
										images: {mediapath: short_name + '.webp', alt: "", caption: ""}, // TODO
 | 
				
			||||||
					season: season_local,
 | 
										season: season_local,
 | 
				
			||||||
					short_name,
 | 
										short_name : short_name.trim(),
 | 
				
			||||||
					portions: portions_local,
 | 
										portions: portions_local,
 | 
				
			||||||
					datecreated,
 | 
										datecreated,
 | 
				
			||||||
					datemodified,
 | 
										datemodified,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -160,7 +160,7 @@
 | 
				
			|||||||
			async function upload_img(){
 | 
								async function upload_img(){
 | 
				
			||||||
        			const data = {
 | 
					        			const data = {
 | 
				
			||||||
					image: img_local,
 | 
										image: img_local,
 | 
				
			||||||
					name: short_name,
 | 
										name: short_name.trim(),
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
        			const res = await fetch(`/api/rezepte/img/add`, {
 | 
					        			const res = await fetch(`/api/rezepte/img/add`, {
 | 
				
			||||||
        			    method: 'POST',
 | 
					        			    method: 'POST',
 | 
				
			||||||
@@ -191,7 +191,7 @@
 | 
				
			|||||||
        			    },
 | 
					        			    },
 | 
				
			||||||
				body: JSON.stringify({
 | 
									body: JSON.stringify({
 | 
				
			||||||
					old_name: old_short_name,
 | 
										old_name: old_short_name,
 | 
				
			||||||
					new_name: short_name,
 | 
										new_name: short_name.trim(),
 | 
				
			||||||
				})
 | 
									})
 | 
				
			||||||
			})
 | 
								})
 | 
				
			||||||
			if(!res_img.ok){
 | 
								if(!res_img.ok){
 | 
				
			||||||
@@ -208,7 +208,7 @@
 | 
				
			|||||||
					...add_info,
 | 
										...add_info,
 | 
				
			||||||
					images, // TODO
 | 
										images, // TODO
 | 
				
			||||||
					season: season_local,
 | 
										season: season_local,
 | 
				
			||||||
					short_name,
 | 
										short_name short_name.trim(),
 | 
				
			||||||
					datecreated,
 | 
										datecreated,
 | 
				
			||||||
					portions: portions_local,
 | 
										portions: portions_local,
 | 
				
			||||||
					datemodified,
 | 
										datemodified,
 | 
				
			||||||
@@ -228,7 +228,7 @@
 | 
				
			|||||||
		if(res.ok){
 | 
							if(res.ok){
 | 
				
			||||||
			const url = location.href.split('/');
 | 
								const url = location.href.split('/');
 | 
				
			||||||
			url.splice(url.length -2, 2);
 | 
								url.splice(url.length -2, 2);
 | 
				
			||||||
			url.push(short_name);
 | 
								url.push(short_name.trim());
 | 
				
			||||||
			location.assign(url.join('/'))
 | 
								location.assign(url.join('/'))
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		else{
 | 
							else{
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user