media.py sets CWD to the media directory of the collection
(collection.media), and relies on that directory being
maintained as CWD throughout execution. The original CWD
is restored in the close() function.
Remove reliance on CWD being set and maintained throughout
execution of media.py. Improves portability and usability
in different codebases.
- always store media references in fields in NFC form
- always encode filenames on disk in NFC form on machines other than macs
- use relevant encoding when placing files in the media folder during syncs
and apkg imports as well
- rename 'unused media' back to 'check media'
- check media can now automatically change media references and filename
encodings to the correct format
- add writeData() so we can add files to media folder without having to
save them in an intermediate folder first
- we were stripping or checking for illegal filename characters in
multiple places; factor those checks out into separate routines
- add * to invalid char list, and disallow both forward and backslash
- remove size checks in syncAdd(); is handled server-side
- split quoted and unquoted image case into separate regexps, since we can't
include a group reference inside a character set
- disallow spaces in the non-quoted case
- this should fix matching on images with other attributes again