This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author jaraco
Recipients jaraco, p-ganssle, xtreak
Date 2021-12-28.21:15:41
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1640726141.83.0.795460388952.issue46124@roundup.psfhosted.org>
In-reply-to
Content
> Does `joinpath` have less validation?

Yes. Previously, resources.* would perform some validation on the path to ensure that it didn't contain path separators (to avoid users attempting to get resources in subdirectories or perhaps manipulating the path in other ways).

So no, they're not equivalent. If `resource_name` or "zones" ever contained path separators, the former implementation would raise an error whereas this implementation would attempt to join those characters to the path. Since "zones" is a static string, it's clearly not affected. And `resource_name` can't have posixpath.sep. If `key` had an ntpath.sep, that might behave differently, but that seemed like an edge case not worth exploring.

If it is worth exploring, I would recommend not to use normalize_path, but instead to implement the validation in zoneinfo._common. That is, wrap key in `_validate_key()` that protects against invalid paths. But in practice, it's better to do that closer to where the unsanitized data would be encountered (if at all).
History
Date User Action Args
2021-12-28 21:15:41jaracosetrecipients: + jaraco, p-ganssle, xtreak
2021-12-28 21:15:41jaracosetmessageid: <1640726141.83.0.795460388952.issue46124@roundup.psfhosted.org>
2021-12-28 21:15:41jaracolinkissue46124 messages
2021-12-28 21:15:41jaracocreate