Skip to content

Commit

Permalink
Merge pull request #1168 from Amsterdam/bugfix/95101-alfresco-file-up…
Browse files Browse the repository at this point in the history
…load-fails

95101
  • Loading branch information
remyvdwereld authored Oct 12, 2023
2 parents 0f51910 + 8e4f4ec commit f751ff4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
7 changes: 5 additions & 2 deletions app/apps/openzaak/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ def _build_document_body(
):
file.seek(0)
content = file.read()
file_size = len(content)

string_content = base64.b64encode(content).decode("utf-8")
informatieobjecttype = (
informatieobjecttype
Expand All @@ -105,13 +107,13 @@ def _build_document_body(
)
# Get mime type
try:
(mimeType, *_) = mimetypes.guess_type(pathlib.Path(file.name))
(mime_type, *_) = mimetypes.guess_type(pathlib.Path(file.name))
except Exception as e:
logger.info(f"MIME-type cannot be detected: {e}")

document_body = {
"identificatie": uuid.uuid4().hex,
"formaat": mimeType,
"formaat": mime_type,
"informatieobjecttype": informatieobjecttype,
"bronorganisatie": settings.DEFAULT_RSIN,
"creatiedatum": _parse_date(date.today()),
Expand All @@ -121,6 +123,7 @@ def _build_document_body(
"bestandsnaam": file.name,
"inhoud": string_content,
"indicatieGebruiksrecht": False,
"bestandsomvang": file_size, # total bytes as integer
}
if lock:
document_body["lock"] = lock
Expand Down
6 changes: 5 additions & 1 deletion app/config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,13 @@
"VERSION": "v1",
}

TAG_NAME = os.getenv("TAG_NAME", "default-release")

# Error logging through Sentry
sentry_sdk.init(
dsn=os.environ.get("SENTRY_DSN", ""), integrations=[DjangoIntegration()]
dsn=os.environ.get("SENTRY_DSN"),
integrations=[DjangoIntegration()],
release=TAG_NAME,
)

LOGGING = {
Expand Down

0 comments on commit f751ff4

Please sign in to comment.