Skip to content
This repository has been archived by the owner on Aug 27, 2023. It is now read-only.

Summary sent to s3 to be normalized and stripped of non-ASCII characters #197

Closed
wants to merge 1 commit into from
Closed
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
5 changes: 4 additions & 1 deletion pypicloud/storage/s3.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
""" Store packages in S3 """
import posixpath
import unicodedata

import boto3
import logging
Expand Down Expand Up @@ -189,7 +190,9 @@ def upload(self, package, datastream):
kwargs["StorageClass"] = self.storage_class
metadata = {"name": package.name, "version": package.version}
if package.summary:
metadata["summary"] = package.summary
metadata["summary"] = u''.join(
c for c in unicodedata.normalize('NFKD', package.summary) if ord(c) < 128
)
key.put(Metadata=metadata, Body=datastream, **kwargs)

def delete(self, package):
Expand Down