opengisch / qfieldsync

Sync your projects to QField
https://qfield.org/
GNU Lesser General Public License v3.0
55 stars 25 forks source link

Adding validator for files on converter to cloud project #614

Closed SeqLaz closed 3 days ago

SeqLaz commented 1 month ago

Based on: https://github.com/opengisch/libqfieldsync/pull/95

SeqLaz commented 1 month ago

I would add such function in file utils.

Also the pattern is a bit more complex, expecially for windows. Can we use something like this:

\A(?!(?:COM[0-9]|CON|LPT[0-9]|NUL|PRN|AUX|com[0-9]|con|lpt[0-9]|nul|prn|aux)|\s|[\.]{2,})[^\\\/:*"?<>|]{1,254}(?<![\s\.])\z

Even better, we can check if pathvalidate is installed and use that, otherwise fallback to the above regex (or better one). Don't forget to check if the file path is also correct.

Thank you. Due to the library pathvalidate not being installed, I used your regex for the validations and moved the function to /utils/file_utils.py.

SeqLaz commented 1 month ago

ProjectChecker

Can we use the ProjectChecker for providing this kind of feedback? There is already ASCII filename warnings, the file one to be added should be an error that prevents further actions with the project.

For this it will be require to add a method to libqfieldsync

suricactus commented 1 month ago

Can you add a screencast how this works? Code looks good enough for now.

SeqLaz commented 3 weeks ago

Can you add a screencast how this works? Code looks good enough for now.

@suricactus There in the up is with when the message is directly on QFieldSync on the down when is using the libqfieldsync

Using directly QFieldSync

https://github.com/user-attachments/assets/fbb89cdd-aa5e-4f2c-ab3a-758dd0119d1f

Using libqfieldsync

https://github.com/user-attachments/assets/875183e9-9658-4d21-bbe6-707657bd5691

My vote is for opt for the libqfieldsync option, also is already for create a PR

SeqLaz commented 3 weeks ago

I like the second option too! Thanks, good work! Please link the libqfieldsync PR here when ready.

If we opt for the second option we can close this PR, all the logic is managed in this PR https://github.com/opengisch/libqfieldsync/pull/95

suricactus commented 3 weeks ago

Actually you can reopen this and just bump your linqfieldsync commit version.

SeqLaz commented 3 weeks ago

Hey @suricactus I removed all the previous commits and add the last master libqfieldsync as part of the requirements, on the last master was merged the PR