Skip to content

Conversation

@jxltom
Copy link

@jxltom jxltom commented Mar 27, 2018

Step to reproduce:

  • For example, if file_example2 already exists in OSS, exists() function will return True for file file_example even though it is not. Then collectstatic will try to get meta data of this file and then error will be raised since file does not actually exist.

Reason:

  • It is because in Linux (maybe also in Windows), os.path.normpath will remove / which is at the end of path. For example, /path/path/ will be normalized to /path/path. So the exits() method which checks existence of a folder by self.bucket.list_objects(prefix='/path/path/', delimiter='', marker='', max_keys=1) is actually checking by self.bucket.list_objects(prefix='/path/path', delimiter='', marker='', max_keys=1) without / at the end of prefix

How to fix:

  • It is fixed by appending / to the end of path if original path is ends with /.

@jxltom jxltom changed the title Fix oss2 error when running collectstatic Fix non-existed file is improperly considered as existed when running collectstatic Mar 27, 2018
@CLAassistant
Copy link

CLAassistant commented Jul 5, 2019

CLA assistant check
All committers have signed the CLA.

@huiguangjun
Copy link
Contributor

merged

@jxltom
Copy link
Author

jxltom commented Dec 16, 2019

Why this PR is merged without my author information. It is quite uncommon in open source.

@favoyang
Copy link
Contributor

@jxltom, because the maintainer merged a combined PR (#24), which makes you the indirect author, and not shown on https://github.com/aliyun/django-oss-storage/graphs/contributors.

Anyway, the project doesn't have a contributor file.

@jxltom
Copy link
Author

jxltom commented Dec 16, 2019

Obviously, the merged PR could of course cherrypick my commits which includes my author information. It is much better way for open source projects.

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.

4 participants