support file-as-volume (#696);

a volume can be a single file instead of a folder,
but a misleading warning indicated otherwise
This commit is contained in:
ed 2025-08-27 19:17:36 +00:00
parent 2848941e01
commit aa1c921302
2 changed files with 8 additions and 0 deletions

View file

@ -572,6 +572,8 @@ for example `-v /mnt::r -v /var/empty:web/certs:r` mounts the server folder `/mn
the example config file right above this section may explain this better; the first volume `/` is mapped to `/srv` which means http://127.0.0.1:3923/music would try to read `/srv/music` on the server filesystem, but since there's another volume at `/music` mapped to `/mnt/music` then it'll go to `/mnt/music` instead
> this also works for single files, because files can also be volumes
## dotfiles

View file

@ -926,6 +926,12 @@ class Up2k(object):
with self.mutex, self.reg_mutex:
# only need to protect register_vpath but all in one go feels right
for vol in vols:
if bos.path.isfile(vol.realpath):
self.volstate[vol.vpath] = "online (just-a-file)"
t = "NOTE: volume [/%s] is a file, not a folder"
self.log(t % (vol.vpath,))
continue
try:
# mkdir gonna happen at snap anyways;
bos.makedirs(vol.realpath, vf=vol.flags)