Skip to content

Comments

cli push: Use os.walk instead of glob; upload with full path#8

Merged
soulshake merged 1 commit intoneocities:masterfrom
sharph:feature/csh/os-walk
Sep 28, 2019
Merged

cli push: Use os.walk instead of glob; upload with full path#8
soulshake merged 1 commit intoneocities:masterfrom
sharph:feature/csh/os-walk

Conversation

@sharph
Copy link
Contributor

@sharph sharph commented Sep 28, 2019

In python 2.7 the recursive argument on glob is not supported, so this commit adds os.walk to discover all the files under a path.

Passing os.path.split(file)[1] to nc.upload stripped the path resulting in a flattened file structure at the destination. This commit uses os.path.relpath to find what the destination path should be relative to dirc.

Finally, this fixes a bug where files with names like DSC1234.JPG were not being uploaded because the check against the supExt list was case sensitive.

In python 2.7 the recursive argument on glob is not supported, so this
commit adds os.walk to discover all the files under a path.

Passing os.path.split(file)[1] to nc.upload stripped the path resulting
in a flattened file structure at the destination. This commit uses
os.path.relpath to find what the destination path should be relative to
dirc.

Finally, this fixes a bug where files with names like DSC1234.JPG were
not being uploaded because the check against the supExt list was case
sensitive.
@soulshake
Copy link
Collaborator

Nice, thanks!

@soulshake soulshake merged commit 213b197 into neocities:master Sep 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants