Hi
Hi
i have a problem with Amazon S3, Berlin, when i call a :
StorageService.GetObjectProperties
work fine, but if file have these chars: ( ) in file name then StorageService.GetObjectProperties return Always false.
Are there any encode or other ?
StorageService.GetObjectProperties('mydeploy-bck', 'Dir/SubDir/XXXXXYYY(A)ZZZZ.ZIP', Properties, MetaData)
code:
function Amazon_Download_File_Progress(myConnectionInfo: TAmazonConnectionInfo; sBucketName, sFileLocale, sFileRemoto: string;OnProgress_BEGIN,OnProgress:TOnProgressEvent;MyProgressBar1:TProgressBar): Boolean;
var
ResponseInfo: TCloudResponseInfo;
StorageService: TAmazonStorageService;
ObjectName: string;
FileStream: TStream;
ProgressStream: TProgressStream;
MetaData: TStrings;
Properties: TStrings;
ContentLength: Int64;
// ResultFileStream: TMemoryStream;
begin
Result := False;
StorageService := TAmazonStorageService.Create(myConnectionInfo);
ResponseInfo := TCloudResponseInfo.Create;
try
ObjectName := sFileRemoto; // ExtractFileName(sFileLocale);
if StorageService.GetObjectProperties(sBucketName, ObjectName, Properties, MetaData) then
begin
try
ContentLength := StrToInt(Properties.Values['Content-Length']);
finally
MetaData.Free;
Properties.Free;
end;
https://stackoverflow.com/questions/41899949/can-i-monitor-the-progress-of-an-s3-download-using-the-cloud-amazonapi/
i have a problem with Amazon S3, Berlin, when i call a :
StorageService.GetObjectProperties
work fine, but if file have these chars: ( ) in file name then StorageService.GetObjectProperties return Always false.
Are there any encode or other ?
StorageService.GetObjectProperties('mydeploy-bck', 'Dir/SubDir/XXXXXYYY(A)ZZZZ.ZIP', Properties, MetaData)
code:
function Amazon_Download_File_Progress(myConnectionInfo: TAmazonConnectionInfo; sBucketName, sFileLocale, sFileRemoto: string;OnProgress_BEGIN,OnProgress:TOnProgressEvent;MyProgressBar1:TProgressBar): Boolean;
var
ResponseInfo: TCloudResponseInfo;
StorageService: TAmazonStorageService;
ObjectName: string;
FileStream: TStream;
ProgressStream: TProgressStream;
MetaData: TStrings;
Properties: TStrings;
ContentLength: Int64;
// ResultFileStream: TMemoryStream;
begin
Result := False;
StorageService := TAmazonStorageService.Create(myConnectionInfo);
ResponseInfo := TCloudResponseInfo.Create;
try
ObjectName := sFileRemoto; // ExtractFileName(sFileLocale);
if StorageService.GetObjectProperties(sBucketName, ObjectName, Properties, MetaData) then
begin
try
ContentLength := StrToInt(Properties.Values['Content-Length']);
finally
MetaData.Free;
Properties.Free;
end;
https://stackoverflow.com/questions/41899949/can-i-monitor-the-progress-of-an-s3-download-using-the-cloud-amazonapi/
Did you check if your filename was not maybe implicitly converted by Amazon S3 when creating the file? Something like ... stackoverflow.com - Amazon S3 Unicode filenames, which Unicode Normal form? ... besides of that I have no idea ... there is some use of AnsiLowerCase in the Delphi S3-Service sources but that should have no problem with ( or ).
ReplyDeleteSo you might replace ( with %28 and ) with %29 - but I am not sure if you won't run into double encoding problems than and if this might possibly solve the problem at all.
So - it might be best to step into TCloudService.IssueHeadRequest and see what is requested in the problematic situations.
with %28 and %29 work fine, thank you.
ReplyDeleteMauro Botta Cool. Thanks for the feedback. yw
ReplyDelete