zola icon indicating copy to clipboard operation
zola copied to clipboard

Asset colocation for files without an extension

Open tsheinen opened this issue 9 months ago • 12 comments

Hi!

In versions 0.15.3 to 0.17.0 Zola would colocate files without an extension. I serve files without an extension on my website fairly frequently and would prefer to avoid renaming them if possible (rehosting challenge binaries for CTF writeups). I would like to be able to configure and disable that behavior. I'm happy to fix and MR this but wanted to chat about design first.

Thanks!

tsheinen avatar Nov 04 '23 14:11 tsheinen

Can you pinpoint the commit that changed the behaviour? I don't think that was intentional

Keats avatar Nov 04 '23 19:11 Keats

https://github.com/getzola/zola/commit/f363ea1ae8ea2626e58c116fce03e59653a3c762#diff-06572a96a58dc510037d5efa622f9bec8519bc1beab13c9f251e97e657a9d4ed

tsheinen avatar Nov 04 '23 19:11 tsheinen

Ah I forgot about that! Maybe we should allow files without extensions?

Keats avatar Nov 05 '23 14:11 Keats

I use files without an extension. It kinda looks like it would be a hassle to wire up the config code with the code that filters out extensionless files, but tbh I can't really think of a use case where extensionless files should be filtered out. maybe i'm just too linux-brained lol but it seems like they are pretty common and not having an extension doesn't really signify anything.

tsheinen avatar Nov 05 '23 14:11 tsheinen

The thought (I believe) was that if it didn't have an extension it was probably a temp file from some editor. I'm not sure how to fix it outside of allowing all files without extensions and including files previously ignored 🤔

Keats avatar Nov 05 '23 16:11 Keats

maybe filter out hidden files instead of extensionless files? assuming those temp files are hidden

tsheinen avatar Nov 05 '23 17:11 tsheinen

Kind hard to define hidden files across OSes. Maybe we should just allow extensionless files in colocated assets and we will see if we get more random files being added to builds

Keats avatar Nov 05 '23 21:11 Keats

yeah that's fair. could just implement it cross platform with conditional compilation but it kinda sucks to pull in operating system restrictions that aren't absolutely needed. and it doesn't solve the root issue that some files are getting silently ignored in a way that isn't configurable. maybe could implement something like .gitignore with default rules?

tsheinen avatar Nov 06 '23 03:11 tsheinen

actually tbh could probably literally just use .gitignore and ship a default one with new sites. if they aren't using git oh well theres an extra file floating around but that should capture "files we dont want served" in most cases.

tsheinen avatar Nov 06 '23 03:11 tsheinen

I guess we could follow .gitignore on top of the current known temp files, that's a good idea

Keats avatar Nov 09 '23 20:11 Keats

It would be nice to support related assets without extensions.

To add an additional example, I am hosting posts which sometimes contain source files and for convenience a Makefile.

johannst avatar Nov 14 '23 22:11 johannst

Yeah the commit introducing that was only thinking of weird tmp files, not valid usecases

Keats avatar Nov 15 '23 16:11 Keats