@@ -453,9 +453,10 @@ proc extractAll*(
453453 reader.close ()
454454
455455when (NimMajor , NimMinor , NimPatch ) >= (1 , 6 , 0 ):
456- proc createZipArchive * (
457- entries: sink OrderedTable [string , string ]
458- ): string {.raises : [ZippyError ].} =
456+ # For some reason `sink Table | OrderedTable` does not work, so work around:
457+ template createZipArchiveImpl (
458+ entries: var Table [string , string ] | var OrderedTable [string , string ]
459+ ) =
459460
460461 proc add16 (dst: var string , v: int16 | uint16 ) =
461462 dst.setLen (dst.len + 2 )
@@ -618,3 +619,13 @@ when (NimMajor, NimMinor, NimPatch) >= (1, 6, 0):
618619 result .add32 (uint32 .high) # Size of central directory (bytes) (or 0xffffffff for ZIP64)
619620 result .add32 (uint32 .high) # Offset of start of central directory, relative to start of archive (or 0xffffffff for ZIP64)
620621 result .add16 (0 )
622+
623+ proc createZipArchive * (
624+ entries: sink Table [string , string ]
625+ ): string {.raises : [ZippyError ].} =
626+ createZipArchiveImpl (entries)
627+
628+ proc createZipArchive * (
629+ entries: sink OrderedTable [string , string ]
630+ ): string {.raises : [ZippyError ].} =
631+ createZipArchiveImpl (entries)
0 commit comments