-
Notifications
You must be signed in to change notification settings - Fork 22
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
Error: a bytes-like object is required, not 'str' #52
Comments
With latest release of Is there any consideration to encode name any more? Simply passing try:
u: str = client.presigned_get_object(
bucket_name=self.bucket,
object_name=name.encode('utf-8'),
expires=get_setting("MINIO_URL_EXPIRY_HOURS", timedelta(days=7)) # Default is 7 days
)
return u
except urllib3.exceptions.MaxRetryError:
raise ConnectionError("Couldn't connect to Minio. Check django_minio_backend parameters in Django-Settings") |
I have model: class PersonDocument(CreatedUpdatedAbstractModel):
person = models.ForeignKey(
"employment.Person", on_delete=models.CASCADE, related_name="documents"
)
file = models.FileField(
storage=MinioBackend(
bucket_name=settings.DOCUMENT_PRIVATE_BUCKET,
),
upload_to=get_person_document_upload_path,
)
def get_person_document_upload_path(instance: Model, filename: str) -> str:
return os.path.join(
"person", str(instance.person.id), "documents", str(filename)
).replace("\\", "/")`
|
datetime import changed to fix the now obsolete .utcnow() call typehint fix pinned minio-py version to >=7.2.8
version 3.7.2 fixes this issue. please check, and let me know if you experience any other problems! |
I updated minio package from 7.2.6 to 7.2.8 ,
After file uploaded to FileField and go to obj change page in django admin , raise error a bytes-like object is required, not 'str'
The text was updated successfully, but these errors were encountered: