Dont tag files that aren't PDFs
This commit is contained in:
parent
95ee92cef6
commit
f1757be96e
@ -334,17 +334,16 @@ class WorkAddDocumentView(CollectionMixin, CreateView):
|
||||
# auto tag the document
|
||||
|
||||
#name, ext = os.path.splitext(os.path.basename(doc.upload.name))
|
||||
parts = re.split(r'[^A-Za-z]+', orig_name)
|
||||
parts.reverse()
|
||||
for word in parts:
|
||||
try:
|
||||
tag = MUSIC_TAG_BY_NAME[word.lower()]
|
||||
doc.sections.create(tag=tag)
|
||||
break
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
|
||||
if doc.doctype == models.Document.DOCTYPE_PDF:
|
||||
parts = re.split(r'[^A-Za-z]+', orig_name)
|
||||
parts.reverse()
|
||||
for word in parts:
|
||||
try:
|
||||
tag = MUSIC_TAG_BY_NAME[word.lower()]
|
||||
doc.sections.create(tag=tag)
|
||||
break
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
if self.request.headers['Accept'] == 'application/json':
|
||||
filename = os.path.basename(doc.upload.name)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user