Ignore hidden files? #865
andrewsinnovations
started this conversation in
Ideas
Replies: 2 comments
-
What would you think of #866 ? |
Beta Was this translation helpful? Give feedback.
0 replies
-
That looks like it will work great! Thank you! |
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
-
I've found myself in a pattern where I will write code like this:
index.sql
tabs.sql
In this example, I just want to re-use the tabs code on every page without having to re-write it and potentially miss tabs as the application grows.
However, imagine now that index.sql is behind an authentication check:
index.sql
The Problem:
I also have to duplicate the authentication check in tabs.sql, because I don't want a user who knows that such a route exists to be able to access my partials.
I have lots of partials around in my apps, and I realized that if you know the URL of them, SQLPage will happily serve them up, so I have to add the authentication checks to those endpoints.
What I have been doing
I either just add the auth checks to my partials, or I put the partials under the "sqlpage" folder, because it seems the default behavior of SQLPage is to not serve up endpoints from the "/sqlpage/**/*" route. I haven't seen documentation that says that is the intended behavior, though. So it could change in the future.
Also, putting the partials under /sqlpage/ folder is crowding that path, and I would really like the partials to be near the code that uses them.
My Proposed Solution
What if sqlpage followed the "hidden file" spec of a dot "." in front of the filename. If a file is named ".tabs.sql" then it will refuse to serve "/tabs.sql" or "/tabs" as that file is intentionally hidden. Then you can put the partials in the same path as the code that uses them, and also not have to duplicate authentication checks.
I'm very new to rust, but I believe I could code this up and submit it as a PR if it's something that is a good idea.
Beta Was this translation helpful? Give feedback.
All reactions