Skip to content

Commit 296b8bc

Browse files
Bug fix: Alexandre Magno
1 parent da2a4d4 commit 296b8bc

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/RESTRequest4D.Request.FPHTTPClient.pas

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,7 @@ function TRequestFPHTTPClient.AddFile(const AFieldName: string; const AFileName:
535535
function TRequestFPHTTPClient.AddFile(const AFieldName: string; const AValue: TStream; const AFileName: string; const AContentType: string): IRequest;
536536
var
537537
LFile: TFile;
538+
LFileName: string;
538539
begin
539540
Result := Self;
540541
if not Assigned(AValue) then
@@ -543,7 +544,11 @@ function TRequestFPHTTPClient.AddFile(const AFieldName: string; const AValue: TS
543544
begin
544545
if not FFiles.ContainsKey(AFieldName) then
545546
begin
546-
LFile := TFile.Create(AValue, AFileName, AContentType);
547+
LFileName := AFileName;
548+
if LFileName.Trim.IsEmpty then
549+
LFileName := AFieldName;
550+
551+
LFile := TFile.Create(AValue, LFileName, AContentType);
547552
FFiles.AddOrSetValue(AFieldName, LFile);
548553
end;
549554
end;

0 commit comments

Comments
 (0)