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

Use File field for other content types than Image or File #46

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/onlyoffice/plone/core/fileUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,15 @@ def getFileNameWithoutExt(context):

def getFileExt(context):
portal_type = context.portal_type

filename = None


if hasattr(context, 'file'):
#Check if content has uploaded file, in case required setting is disabled
if context.file is not None:
#Check if file contains data, for use with other content types than Image and File
filename = context.file.filename if context.file.getSize() and context.file.getSize() > 1 else None

if portal_type == "Image" :
filename = context.image.filename if hasattr(context, "image") else None

Expand Down