View Issue Details

IDProjectCategoryView StatusLast Update
0035674FPCPackagespublic2019-07-16 16:57
ReporterMichal GawryckiAssigned ToMichael Van Canneyt 
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Product VersionProduct Build 
Target VersionFixed in Version3.3.1 
Summary0035674: TUnZipper and custom output stream - do not create a TFileStream for directories
DescriptionTUnZipper and custom output stream via OnCreateStream event - TUnZipper should not create TFileStream if current item is a directory and event handler returns an unassigned stream (nil).
Now if the OnCreateStream event handler does not create a stream and returns "AStream" = nil, TFileStream is created even for the directory. In the case of a directory, it should not create any stream because it is not used anywhere.
Patch attached.
TagsNo tags attached.
Fixed in Revision42174
FPCOldBugId
FPCTarget3.2.0
Attached Files
  • zipper.pp.patch (703 bytes)
    Index: packages/paszlib/src/zipper.pp
    ===================================================================
    --- packages/paszlib/src/zipper.pp	(revision 42119)
    +++ packages/paszlib/src/zipper.pp	(working copy)
    @@ -2147,7 +2147,7 @@
       If Assigned(FOnCreateStream) then
         FOnCreateStream(Self, OutStream, Item);
       // If FOnCreateStream didn't create one, we create one now.
    -  If (OutStream=Nil) then
    +  If (OutStream=Nil) and (not Item.IsDirectory) then
         begin
         if (Path<>'') then
           ForceDirectories(Path);
    @@ -2173,7 +2173,8 @@
         OutStream := nil;
       end
       else
    -    FreeAndNil(OutStream);
    +    if Assigned(OutStream) then
    +      FreeAndNil(OutStream);
       DoEndOfFile;
     end;
     
    
    zipper.pp.patch (703 bytes)

Activities

Michal Gawrycki

2019-06-04 20:48

reporter  

zipper.pp.patch (703 bytes)
Index: packages/paszlib/src/zipper.pp
===================================================================
--- packages/paszlib/src/zipper.pp	(revision 42119)
+++ packages/paszlib/src/zipper.pp	(working copy)
@@ -2147,7 +2147,7 @@
   If Assigned(FOnCreateStream) then
     FOnCreateStream(Self, OutStream, Item);
   // If FOnCreateStream didn't create one, we create one now.
-  If (OutStream=Nil) then
+  If (OutStream=Nil) and (not Item.IsDirectory) then
     begin
     if (Path<>'') then
       ForceDirectories(Path);
@@ -2173,7 +2173,8 @@
     OutStream := nil;
   end
   else
-    FreeAndNil(OutStream);
+    if Assigned(OutStream) then
+      FreeAndNil(OutStream);
   DoEndOfFile;
 end;
 
zipper.pp.patch (703 bytes)

Michael Van Canneyt

2019-06-05 13:43

administrator   ~0116575

Checked and applied, thanks for the patch !

Michal Gawrycki

2019-07-16 16:57

reporter   ~0117276

Thanks! Closed.

Issue History

Date Modified Username Field Change
2019-06-04 20:48 Michal Gawrycki New Issue
2019-06-04 20:48 Michal Gawrycki File Added: zipper.pp.patch
2019-06-05 12:47 Michael Van Canneyt Assigned To => Michael Van Canneyt
2019-06-05 12:47 Michael Van Canneyt Status new => assigned
2019-06-05 13:43 Michael Van Canneyt Status assigned => resolved
2019-06-05 13:43 Michael Van Canneyt Resolution open => fixed
2019-06-05 13:43 Michael Van Canneyt Fixed in Version => 3.3.1
2019-06-05 13:43 Michael Van Canneyt Fixed in Revision => 42174
2019-06-05 13:43 Michael Van Canneyt FPCTarget => 3.2.0
2019-06-05 13:43 Michael Van Canneyt Note Added: 0116575
2019-07-16 16:57 Michal Gawrycki Status resolved => closed
2019-07-16 16:57 Michal Gawrycki Note Added: 0117276