Why does the unversioned share require file names without spaces?
(1) By Mike Swanson (chungy) on 2025-03-24 08:14:22 [link] [source]
In unversioned.c, there is an explicit prohibition on file names with whitespace in them. No such restriction exists for the versioned trees, causing an apparently inconsistent behavior.
It seems trivial to delete the whitespace checks and function for it, and fossil will happily add such file names to the unversioned store. At present, doing this results in the WebUI replacing spaces with the +
character (which might be worse than replacing spaces with underscore before adding them), but I imagine the WebUI could be patched so that the URL reads out with %20 sequences anyway, preserving the original with-spaces name.
I don't know the justification behind this restriction. Not that it's a big deal to do a rename before hand to replace spaces with underscores before using fossil uv add $FILE...
, but it would be slightly more pleasant to not have to do that.
(2) By Stephan Beal (stephan) on 2025-03-24 11:50:53 in reply to 1 [source]
At present, doing this results in the WebUI replacing spaces with the + character (which might be worse than replacing spaces with underscore before adding them),
The space-as-+ is actually from URL encoding, but it's far more common nowadays to see spaces encoded as %20. The "+" was more commonly seen in the late 90s/early 2000s, probably because it was easier to work with in the CGIs of the time.
I don't know the justification behind this restriction.
This is speculation, but it may have been done "out of habit" - the web server long maintained by our project lead (drh/Richard) has that same quirk and fossil derives some pieces from it. e.g. althttpd doesn't like any characters which have even a small chance of causing mischief, so is very restrictive on names, and fossil inherits that. Fossil is less restrictive for versioned content because it effectively has to be (it wouldn't be realistic to place arbitrary naming limitations on such content).