소스 검색

fixes behavior when mimtype fail guessing file extension

root 8 년 전
부모
커밋
97f0670a24
1개의 변경된 파일3개의 추가작업 그리고 2개의 파일을 삭제
  1. 3 2
      tracim/tracim/lib/webdav/sql_resources.py

+ 3 - 2
tracim/tracim/lib/webdav/sql_resources.py 파일 보기

@@ -850,8 +850,9 @@ class File(DAVNonCollection):
850 850
 
851 851
     def getPreferredPath(self):
852 852
         fix_txt = '.txt' if self.getContentType() == 'text/plain' else mimetypes.guess_extension(self.getContentType())
853
-
854
-        if self.content.label == '' or self.path.endswith(fix_txt):
853
+        if not fix_txt:
854
+            fix_txt = ''
855
+        if self.content and self.path and (self.content.label == '' or self.path.endswith(fix_txt)):
855 856
             return self.path
856 857
         else:
857 858
             return self.path + fix_txt