Browse Source

Httpserver: make formsplit also work with chars before the start marker

Marcus Sackrow 1 week ago
parent
commit
2714e2d422
1 changed files with 3 additions and 2 deletions
  1. 3 2
      packages/fcl-web/src/base/httpdefs.pp

+ 3 - 2
packages/fcl-web/src/base/httpdefs.pp

@@ -2139,11 +2139,12 @@ begin
   FBoundary := boundary;
   Sep:=DashDash+boundary+CRLF;
   Slen:=length(Sep);
+  P := Pos(Sep, Cnt);// start of the first marker
   CLen:=Pos(DashDash+Boundary+DashDash,Cnt);
   // Cut last marker
   Cnt:=Copy(Cnt,1,Clen-1);
-  // Cut first marker
-  system.Delete(Cnt,1,Slen);
+  // Cut first marker and everything before that
+  system.Delete(Cnt,1,Slen+P-1);
   Clen:=Length(Cnt);
   While Clen>0 do
     begin