Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cloudooo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tristan Cavelier
cloudooo
Commits
5ef3cd6e
Commit
5ef3cd6e
authored
Jan 04, 2017
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle application/x-asc-*+zip mimetypes
parent
d9878156
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
16 deletions
+22
-16
cloudooo/handler/x2t/handler.py
cloudooo/handler/x2t/handler.py
+7
-7
cloudooo/handler/x2t/tests/testX2tHandler.py
cloudooo/handler/x2t/tests/testX2tHandler.py
+9
-3
cloudooo/manager.py
cloudooo/manager.py
+3
-3
cloudooo/mime.types
cloudooo/mime.types
+3
-3
No files found.
cloudooo/handler/x2t/handler.py
View file @
5ef3cd6e
...
@@ -202,21 +202,21 @@ class Handler(object):
...
@@ -202,21 +202,21 @@ class Handler(object):
"""Returns a list content_type and their titles which are supported
"""Returns a list content_type and their titles which are supported
by enabled handlers.
by enabled handlers.
[('application/x-asc-text', 'OnlyOffice Text Document'),
[('application/x-asc-text
+zip
', 'OnlyOffice Text Document'),
...
...
]
]
"""
"""
source_mimetype
=
parseContentType
(
source_mimetype
).
gettype
()
source_mimetype
=
parseContentType
(
source_mimetype
).
gettype
()
if
source_mimetype
in
(
"docx"
,
"application/vnd.openxmlformats-officedocument.wordprocessingml.document"
):
if
source_mimetype
in
(
"docx"
,
"application/vnd.openxmlformats-officedocument.wordprocessingml.document"
):
return
[(
"application/x-asc-text"
,
"OnlyOffice Text Document"
)]
return
[(
"application/x-asc-text
+zip
"
,
"OnlyOffice Text Document"
)]
if
source_mimetype
in
(
"docy"
,
"application/x-asc-text"
):
if
source_mimetype
in
(
"docy"
,
"application/x-asc-text
+zip"
,
"application/x-asc-text
"
):
return
[(
"application/vnd.openxmlformats-officedocument.wordprocessingml.document"
,
"Word 2007 Document"
)]
return
[(
"application/vnd.openxmlformats-officedocument.wordprocessingml.document"
,
"Word 2007 Document"
)]
if
source_mimetype
in
(
"xlsx"
,
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
):
if
source_mimetype
in
(
"xlsx"
,
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
):
return
[(
"application/x-asc-spreadsheet"
,
"OnlyOffice Spreadsheet"
)]
return
[(
"application/x-asc-spreadsheet
+zip
"
,
"OnlyOffice Spreadsheet"
)]
if
source_mimetype
in
(
"xlsy"
,
"application/x-asc-spreadsheet"
):
if
source_mimetype
in
(
"xlsy"
,
"application/x-asc-spreadsheet
+zip"
,
"application/x-asc-spreadsheet
"
):
return
[(
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
,
"Excel 2007 Spreadsheet"
)]
return
[(
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
,
"Excel 2007 Spreadsheet"
)]
if
source_mimetype
in
(
"pptx"
,
"application/vnd.openxmlformats-officedocument.presentationml.presentation"
):
if
source_mimetype
in
(
"pptx"
,
"application/vnd.openxmlformats-officedocument.presentationml.presentation"
):
return
[(
"application/x-asc-presentation"
,
"OnlyOffice Presentation"
)]
return
[(
"application/x-asc-presentation
+zip
"
,
"OnlyOffice Presentation"
)]
if
source_mimetype
in
(
"ppty"
,
"application/x-asc-presentation"
):
if
source_mimetype
in
(
"ppty"
,
"application/x-asc-presentation
+zip"
,
"application/x-asc-presentation
"
):
return
[(
"application/vnd.openxmlformats-officedocument.presentationml.presentation"
,
"PowerPoint 2007 Presentation"
)]
return
[(
"application/vnd.openxmlformats-officedocument.presentationml.presentation"
,
"PowerPoint 2007 Presentation"
)]
return
[]
return
[]
cloudooo/handler/x2t/tests/testX2tHandler.py
View file @
5ef3cd6e
...
@@ -103,6 +103,12 @@ class TestHandler(HandlerTestCase):
...
@@ -103,6 +103,12 @@ class TestHandler(HandlerTestCase):
None of the types below define any mimetype parameter to not ignore so far.
None of the types below define any mimetype parameter to not ignore so far.
"""
"""
get
=
Handler
.
getAllowedConversionFormatList
get
=
Handler
.
getAllowedConversionFormatList
self
.
assertEquals
(
get
(
"application/x-asc-text+zip;ignored=param"
),
[(
"application/vnd.openxmlformats-officedocument.wordprocessingml.document"
,
"Word 2007 Document"
)])
self
.
assertEquals
(
get
(
"application/x-asc-spreadsheet+zip;ignored=param"
),
[(
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
,
"Excel 2007 Spreadsheet"
)])
self
.
assertEquals
(
get
(
"application/x-asc-presentation+zip;ignored=param"
),
[(
"application/vnd.openxmlformats-officedocument.presentationml.presentation"
,
"PowerPoint 2007 Presentation"
)])
self
.
assertEquals
(
get
(
"application/x-asc-text;ignored=param"
),
self
.
assertEquals
(
get
(
"application/x-asc-text;ignored=param"
),
[(
"application/vnd.openxmlformats-officedocument.wordprocessingml.document"
,
"Word 2007 Document"
)])
[(
"application/vnd.openxmlformats-officedocument.wordprocessingml.document"
,
"Word 2007 Document"
)])
self
.
assertEquals
(
get
(
"application/x-asc-spreadsheet;ignored=param"
),
self
.
assertEquals
(
get
(
"application/x-asc-spreadsheet;ignored=param"
),
...
@@ -110,11 +116,11 @@ class TestHandler(HandlerTestCase):
...
@@ -110,11 +116,11 @@ class TestHandler(HandlerTestCase):
self
.
assertEquals
(
get
(
"application/x-asc-presentation;ignored=param"
),
self
.
assertEquals
(
get
(
"application/x-asc-presentation;ignored=param"
),
[(
"application/vnd.openxmlformats-officedocument.presentationml.presentation"
,
"PowerPoint 2007 Presentation"
)])
[(
"application/vnd.openxmlformats-officedocument.presentationml.presentation"
,
"PowerPoint 2007 Presentation"
)])
self
.
assertEquals
(
get
(
"application/vnd.openxmlformats-officedocument.wordprocessingml.document;ignored=param"
),
self
.
assertEquals
(
get
(
"application/vnd.openxmlformats-officedocument.wordprocessingml.document;ignored=param"
),
[(
"application/x-asc-text"
,
"OnlyOffice Text Document"
)])
[(
"application/x-asc-text
+zip
"
,
"OnlyOffice Text Document"
)])
self
.
assertEquals
(
get
(
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;ignored=param"
),
self
.
assertEquals
(
get
(
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;ignored=param"
),
[(
"application/x-asc-spreadsheet"
,
"OnlyOffice Spreadsheet"
)])
[(
"application/x-asc-spreadsheet
+zip
"
,
"OnlyOffice Spreadsheet"
)])
self
.
assertEquals
(
get
(
"application/vnd.openxmlformats-officedocument.presentationml.presentation;ignored=param"
),
self
.
assertEquals
(
get
(
"application/vnd.openxmlformats-officedocument.presentationml.presentation;ignored=param"
),
[(
"application/x-asc-presentation"
,
"OnlyOffice Presentation"
)])
[(
"application/x-asc-presentation
+zip
"
,
"OnlyOffice Presentation"
)])
def
test_suite
():
def
test_suite
():
return
make_suite
(
TestHandler
)
return
make_suite
(
TestHandler
)
cloudooo/manager.py
View file @
5ef3cd6e
...
@@ -65,9 +65,9 @@ def BBB_guess_type(url):
...
@@ -65,9 +65,9 @@ def BBB_guess_type(url):
split
=
base
.
split
(
"."
)
split
=
base
.
split
(
"."
)
ext
=
''
if
len
(
split
)
==
1
else
split
[
-
1
]
ext
=
''
if
len
(
split
)
==
1
else
split
[
-
1
]
return
{
return
{
"docy"
:
(
"application/x-asc-text"
,
None
),
"docy"
:
(
"application/x-asc-text
+zip
"
,
None
),
"xlsy"
:
(
"application/x-asc-spreadsheet"
,
None
),
"xlsy"
:
(
"application/x-asc-spreadsheet
+zip
"
,
None
),
"ppty"
:
(
"application/x-asc-presentation"
,
None
),
"ppty"
:
(
"application/x-asc-presentation
+zip
"
,
None
),
}.
get
(
ext
,
None
)
or
guess_type
(
url
)
}.
get
(
ext
,
None
)
or
guess_type
(
url
)
def
BBB_guess_extension
(
mimetype
,
title
=
None
):
def
BBB_guess_extension
(
mimetype
,
title
=
None
):
...
...
cloudooo/mime.types
View file @
5ef3cd6e
...
@@ -56,7 +56,7 @@ application/vnd.oasis.opendocument.database
...
@@ -56,7 +56,7 @@ application/vnd.oasis.opendocument.database
application/vnd.oasis.opendocument.image odi
application/vnd.oasis.opendocument.image odi
application/vnd.ms-word.document.macroEnabled.12 docm
application/vnd.ms-word.document.macroEnabled.12 docm
application/vnd.openxmlformats-officedocument.wordprocessingml.document docx
application/vnd.openxmlformats-officedocument.wordprocessingml.document docx
application/x-asc-text
docy
application/x-asc-text
+zip
docy
application/vnd.openxmlformats-officedocument.wordprocessingml.template dotx
application/vnd.openxmlformats-officedocument.wordprocessingml.template dotx
application/vnd.ms-powerpoint.template.macroEnabled.12 potm
application/vnd.ms-powerpoint.template.macroEnabled.12 potm
application/vnd.openxmlformats-officedocument.presentationml.template potx
application/vnd.openxmlformats-officedocument.presentationml.template potx
...
@@ -65,12 +65,12 @@ application/vnd.ms-powerpoint.slideshow.macroEnabled.12
...
@@ -65,12 +65,12 @@ application/vnd.ms-powerpoint.slideshow.macroEnabled.12
application/vnd.openxmlformats-officedocument.presentationml.slideshow ppsx
application/vnd.openxmlformats-officedocument.presentationml.slideshow ppsx
application/vnd.ms-powerpoint.presentation.macroEnabled.12 pptm
application/vnd.ms-powerpoint.presentation.macroEnabled.12 pptm
application/vnd.openxmlformats-officedocument.presentationml.presentation pptx
application/vnd.openxmlformats-officedocument.presentationml.presentation pptx
application/x-asc-presentation
ppty
application/x-asc-presentation
+zip
ppty
application/vnd.ms-excel.addin.macroEnabled.12 xlam
application/vnd.ms-excel.addin.macroEnabled.12 xlam
application/vnd.ms-excel.sheet.binary.macroEnabled.12 xlsb
application/vnd.ms-excel.sheet.binary.macroEnabled.12 xlsb
application/vnd.ms-excel.sheet.macroEnabled.12 xlsm
application/vnd.ms-excel.sheet.macroEnabled.12 xlsm
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx
application/x-asc-spreadsheet
xlsy
application/x-asc-spreadsheet
+zip
xlsy
application/vnd.ms-excel.template.macroEnabled.12 xltm
application/vnd.ms-excel.template.macroEnabled.12 xltm
application/vnd.openxmlformats-officedocument.spreadsheetml.template xltx
application/vnd.openxmlformats-officedocument.spreadsheetml.template xltx
application/x-msmetafile wmf
application/x-msmetafile wmf
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment