Skip to content

Commit

Permalink
Remove unit test for clean file names
Browse files Browse the repository at this point in the history
  • Loading branch information
cgodwin1 committed Jan 11, 2024
1 parent c8b885d commit 47d7312
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 30 deletions.
17 changes: 1 addition & 16 deletions solution/backend/file_manager/admin.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import re

import requests
from django import forms
Expand Down Expand Up @@ -83,24 +82,10 @@ def get_queryset(self, request):
Prefetch("category", AbstractRepoCategory.objects.all().select_subclasses()),
)

# Will remove any characters from file namess we do not want in it.
# Commas in file names causes issues in chrsome on downloads since we rename the file.
def clean_file_name(self, name):
# bad_char = [";", "!", "?", "*", ":", ",", '"', '“', "'", r'/', '\\', '-',]
# temp = ''
# split_name = name.split('.')
# extension = split_name.pop()
# file_name = '.'.join(split_name)
# for i in bad_char:
# temp = temp + i
# clean_name = re.sub(rf'[{temp}]', '', file_name).strip()
# return f'{clean_name}.{extension}'
return name

def save_model(self, request, obj, form, change):
path = form.cleaned_data.get("file_path")
if path:
obj.file_name = self.clean_file_name(path._name)
obj.file_name = path._name
self.upload_file(path, obj)
super().save_model(request, obj, form, change)

Expand Down
14 changes: 0 additions & 14 deletions solution/backend/file_manager/tests/test_admin.py

This file was deleted.

0 comments on commit 47d7312

Please sign in to comment.