Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy file but leave empty suffix #1338

Closed
bachvtuan opened this issue Apr 13, 2023 · 4 comments
Closed

Copy file but leave empty suffix #1338

bachvtuan opened this issue Apr 13, 2023 · 4 comments

Comments

@bachvtuan
Copy link

bachvtuan commented Apr 13, 2023

I tried to copy file and leave empty suffix and get this error:

File "/home/acme/venv/lib/python3.8/site-packages/filer/admin/folderadmin.py", line 562, in response_action
    response = func(self, request, files_queryset, folders_queryset)
  File "/home/acme/venv/lib/python3.8/site-packages/filer/admin/folderadmin.py", line 1092, in copy_files_and_folders
    if form.is_valid():
  File "/home/acme/venv/lib/python3.8/site-packages/django/forms/forms.py", line 201, in is_valid
    return self.is_bound and not self.errors
  File "/home/acme/venv/lib/python3.8/site-packages/django/forms/forms.py", line 196, in errors
    self.full_clean()
  File "/home/acme/venv/lib/python3.8/site-packages/django/forms/forms.py", line 433, in full_clean
    self._clean_fields()
  File "/home/acme/venv/lib/python3.8/site-packages/django/forms/forms.py", line 448, in _clean_fields
    value = getattr(self, "clean_%s" % name)()
  File "/home/acme/venv/lib/python3.8/site-packages/filer/admin/forms.py", line 29, in clean_suffix
    valid = get_valid_filename(self.cleaned_data['suffix'])
  File "/home/acme/venv/lib/python3.8/site-packages/filer/utils/files.py", line 131, in get_valid_filename
    s = get_valid_filename_django(s)
  File "/home/acme/venv/lib/python3.8/site-packages/django/utils/functional.py", line 246, in wrapper
    return func(*args, **kwargs)
  File "/home/acme/venv/lib/python3.8/site-packages/django/utils/text.py", line 249, in get_valid_filename
    raise SuspiciousFileOperation("Could not derive file name from '%s'" % name)
django.core.exceptions.SuspiciousFileOperation: Could not derive file name from ''

Using packages:

  • Django==4.2
  • django-filer==2.2.4

The suffix is not required but leave as empty get this error, what do you think about this error?

@stale
Copy link

stale bot commented Jul 12, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jul 12, 2023
@fsbraun
Copy link
Member

fsbraun commented Jul 12, 2023

@bachvtuan Empty suffices are not supported. Something the forms should validate.

@fsbraun
Copy link
Member

fsbraun commented Jul 12, 2023

Sorry for the confusion: Empty suffices need to be supported (as opposed to empty extensions). This PR corrects the form validation: #1386

@fsbraun
Copy link
Member

fsbraun commented Jul 17, 2023

Now fixed and released. Thank you, @bachvtuan, for reporting this!

@fsbraun fsbraun closed this as completed Jul 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants