Skip to content

Commit

Permalink
fix minio upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Roy committed Nov 22, 2024
1 parent c166733 commit 01df56a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion api/terminal/terminal/common/s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def parse_url(url):

def upload_file(self, bucket, object_key, filepath):
endpoint_info = self.parse_url(self.endpoint)
client = minio.Minio(self.endpoint, self.access_key, self.secret_key, secure=endpoint_info['secure'])
client = minio.Minio(endpoint_info['host'], self.access_key, self.secret_key, secure=endpoint_info['secure'])
return client.fput_object(bucket, object_key, filepath)

def download_file(self, url, filepath):
Expand Down
5 changes: 4 additions & 1 deletion api/terminal/terminal/server/uploader.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ def upload(session_id, filepath, endpoint, ak, sk, bucket, object_key):
if not os.path.exists(filepath):
return
client = s3.S3Client(endpoint, ak, sk)
fullurl = '/'.join(['http://' + endpoint.rstrip('/'), bucket, object_key])
urlprefix = endpoint.rstrip('/')
if not urlprefix.startswith('http'):
urlprefix = 'http://' + urlprefix
fullurl = '/'.join([urlprefix, bucket, object_key])
try:
client.upload_file(bucket, object_key, filepath)
resource.SessionRecord().update(session_id, {'filepath': fullurl})
Expand Down

0 comments on commit 01df56a

Please sign in to comment.