Replies: 1 comment
-
Seems like a good idea! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I wanted to open a discussion somewhat-related to PR #1977 I submitted that you marked as "revisit for next major version". Rather than the sanitization method that I suggested in that PR, I would suggest that this be used:
What this does is create filesystem-friendly filenames that better handle filenames that the current sanitization method doesn't handle very well. Since it's common to use periods to separate filename components (
database.production.sql
for example), this method ensures that they are kept in place. This also has the side effect of preserving the file extension.I grabbed some filenames from my computer and checked out the differences between the current ("old") method and the proposed ("new") method. It only outputs filenames where the old and new methods produce different results:
Here is the output:
As you can see, the current method produces some very strange filenames:
dog,-coffee,-halloween-candy---uv-printed-sign---15x5.pdf
tweeka-tv---episode-12-(the-moskau-edition)---camden-at-52.04-to-52.19.mp4
One interesting side effect of using
Str::slug()
is that UTF-8 characters are turned into their ASCII equivalents. You can see this withAtmosphæra Incognita by Neal Stephenson.pdf
- theæ
becomesae
. This could help with compatibility across different filesystems.In my own application, the current sanitization method has produced tons of strange filenames, despite our use of a pretty standard file naming scheme:
Thank you for your consideration!
Beta Was this translation helpful? Give feedback.
All reactions