Booru-mass-uploader
Booru-mass-uploader copied to clipboard
Filenames with spaces are truncated to the last word dot extension
If you've checkmarked Set Title of each image to its original filename, this is a picture.gif
becomes picture.gif
in the title field.
I suspect this regex in uploader.js
is to blame:
tags = fileName;
title = upOptions.title ? tags.split(/\s+/)[tags.split(/\s+/).length - 1] : '';
It's assuming "last space is delimiter to filename inside fileName" which only works if the filename has no spaces in it.
If I've read the source correctly, fileName
is actually "[rating] [tags] [filename]" where an array would be safer to parse: fileInfo['rating']
, fileInfo['tags']
, fileInfo['filename']
Yes, but how would we separate filename from tags if it has spaces as well?
Two choices:
- bandaid: Use a nonprinting delimiter character that's illegal in most file systems like ESC
- better practices: Stop using string packing as a way to attack this problam and pass
myArray = [rating,tags]
usingformData.append('myArray',myArray[])
Not quite sure what you mean by (2), doesn't the problem lie in file naming, it would be too late to fix it at the uploading stage? It's either stating clearly in the Readme that the files shouldn't have spaces in their name part, or using a special character or multiple spaces to delimit tags from the actual name.
I would opt for an easier solution, since I'm no longer actively developing this project and the last thing I want to do is to break something.