mirror of
https://github.com/grocy/grocy.git
synced 2025-04-29 09:39:57 +00:00
Strip spaces from uploaded file names (fixes #2415)
This commit is contained in:
parent
7f7f1e8dce
commit
99f448dd64
@ -57,6 +57,7 @@
|
|||||||
### General
|
### General
|
||||||
|
|
||||||
- Optimized sidebar icon spacing (thanks @chris-thorn)
|
- Optimized sidebar icon spacing (thanks @chris-thorn)
|
||||||
|
- Fixed that file uploads (product pictures and so on) didn't work for files where the file name contains multiple spaces
|
||||||
|
|
||||||
### API
|
### API
|
||||||
|
|
||||||
|
@ -200,7 +200,12 @@ function QrCodeImgHtml(text)
|
|||||||
function CleanFileName(fileName)
|
function CleanFileName(fileName)
|
||||||
{
|
{
|
||||||
// Umlaute seem to cause problems on Linux...
|
// Umlaute seem to cause problems on Linux...
|
||||||
return fileName.toLowerCase().replaceAll(/ä/g, 'ae').replaceAll(/ö/g, 'oe').replaceAll(/ü/g, 'ue').replaceAll(/ß/g, 'ss');
|
fileName = fileName.toLowerCase().replaceAll(/ä/g, 'ae').replaceAll(/ö/g, 'oe').replaceAll(/ü/g, 'ue').replaceAll(/ß/g, 'ss');
|
||||||
|
|
||||||
|
// Multiple spaces seem to be a problem, so simply strip them all
|
||||||
|
fileName = fileName.replace(/\s+/g, "");
|
||||||
|
|
||||||
|
return fileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
function nl2br(s)
|
function nl2br(s)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user