Closed dteskera closed 3 years ago
bug is in sites.py _upload_file method in line 598 it gets the wrong file_name if its overwriting existing file
possible fix: in sites.py change lines https://github.com/sehmaschine/django-filebrowser/blob/master/filebrowser/sites.py#L588 https://github.com/sehmaschine/django-filebrowser/blob/master/filebrowser/sites.py#L592 so that you get fileobject instead of full_path f = FileObject(smart_str(old_file), site=self) and f = FileObject(smart_str(file_name), site=self)
f = FileObject(smart_str(old_file), site=self)
f = FileObject(smart_str(file_name), site=self)
then change line https://github.com/sehmaschine/django-filebrowser/blob/master/filebrowser/sites.py#L596 os.chmod(f.path_full, DEFAULT_PERMISSIONS)
os.chmod(f.path_full, DEFAULT_PERMISSIONS)
and then you can remove line https://github.com/sehmaschine/django-filebrowser/blob/master/filebrowser/sites.py#L598
P.S. sorry i cant fork it and make a pull request since i already have a fork of a fork that i need to keep.
Pull request: https://github.com/sehmaschine/django-filebrowser/pull/393
thanks. merged the PR.
bug is in sites.py _upload_file method in line 598 it gets the wrong file_name if its overwriting existing file
possible fix: in sites.py change lines https://github.com/sehmaschine/django-filebrowser/blob/master/filebrowser/sites.py#L588 https://github.com/sehmaschine/django-filebrowser/blob/master/filebrowser/sites.py#L592 so that you get fileobject instead of full_path
f = FileObject(smart_str(old_file), site=self)
andf = FileObject(smart_str(file_name), site=self)
then change line https://github.com/sehmaschine/django-filebrowser/blob/master/filebrowser/sites.py#L596
os.chmod(f.path_full, DEFAULT_PERMISSIONS)
and then you can remove line https://github.com/sehmaschine/django-filebrowser/blob/master/filebrowser/sites.py#L598
P.S. sorry i cant fork it and make a pull request since i already have a fork of a fork that i need to keep.