Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

validation message indicates Windows as the platform whereas the offending character is universal #34

Closed
matanox opened this issue Jul 8, 2023 · 2 comments
Labels
Milestone

Comments

@matanox
Copy link

matanox commented Jul 8, 2023

Thank you for this package!

It seems that the value for target-platform below should be not just Windows, but also Linux, or universal. The code is running on linux, producing this justified validation error, only the target-platform field is confusing:

    validate_filename(name)
  File "lib/python3.10/site-packages/pathvalidate/_filename.py", line 318, in validate_filename
    ).validate(filename)
  File "/lib/python3.10/site-packages/pathvalidate/_filename.py", line 191, in validate
    self.__validate_win_filename(unicode_filename)
  File "python3.10/site-packages/pathvalidate/_filename.py", line 221, in __validate_win_filename
    raise InvalidCharError(
pathvalidate.error.InvalidCharError: [PV1100] invalid characters found: invalids=('/'), value='foo / 𝜋', target-platform=Windows

Or is it necessary to specify the target platforms before calling this api?

(I would humbly like to reject for all three popular platforms in my case)

@thombashi
Copy link
Owner

Thank you for your report.
That is a bug.
The error message, in this case, should be like the following:

[PV1100] invalid characters found: invalids=('/'), value='foo / 𝜋', target-platform=universal

I have fixed this. This fix will be included in pathvalidate v3.1

@matanox
Copy link
Author

matanox commented Jul 16, 2023

Awesome and thanks for this small useful library that's really filling a gap for safe coding against the file systems!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants