Include the query in the cache ID - #25
Conversation
GitHub: follow-up red-data-toolsGH-24 Because if URL has any query parameters, the cache ID may be conflicted. The cache ID replaces `/`, `:`, `?`, and `*` with `-`. They may appear in a URL without percent-encoding: * Host: alphanumerics and `- . _ ~ ! $ & ' ( ) * + , ; =` (RFC 3986 3.2.2) * Path: the host characters and `: @` (`/` is the separator) (RFC 3986 3.3) * Query: the path characters and `/ ?` (RFC 3986 3.4) However, they can't be used in file names: * POSIX: `/` * Windows: `< > : " / \ | ? *` ("Naming Files, Paths, and Namespaces" below) See also: * RFC 3986 "Uniform Resource Identifier (URI): Generic Syntax": https://www.rfc-editor.org/rfc/rfc3986 * "Naming Files, Paths, and Namespaces" (Microsoft Learn): https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file Co-authored-by: Sutou Kouhei <kou@clear-code.com>
|
How about using |
Because deny list style is difficult to maintain. The cache ID keeps only the URL unreserved characters (RFC 3986 2.3) and `=` for query readability. Co-authored-by: Sutou Kouhei <kou@clear-code.com>
|
Thanks for your suggestion! I like the allow list style! I've implemented it at bf0f9ab. I've updated the PR description. Could you review it again? |
|
It seems that Can we avoid it? Or we don't need to care about the case...? |
Because "+" isn't in the allow list and can be used in a file name. Co-authored-by: Sutou Kouhei <kou@clear-code.com>
|
Thanks for your finding it! I've changed the query separator from
I've also updated the PR description. |
|
Thanks. |
|
Thanks for your review! |
GitHub: follow-up GH-24
Because if URL has any query parameters, the cache ID may be conflicted.
The query is now included in the cache ID:
example.com+a=bexample.com+a=cSo
clear_cachedoesn't remove caches for other queries.The cache ID keeps only the following characters and replaces all other
characters with
-:A-Z a-z 0-9 - . _ ~(RFC 3986 2.3)=for query readabilitySee also:
https://www.rfc-editor.org/rfc/rfc3986
https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file