File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -454,6 +454,37 @@ object ZipOpTests extends TestSuite {
454454 }
455455 }
456456
457+ test(" zipSymlink" ) - prep { wd =>
458+ val zipFileName = " zipped.zip"
459+ val source = wd / " folder1"
460+ val linkName = " link.txt"
461+ val link = os.rel / linkName
462+
463+ os.symlink(source / link, os.rel / " one.txt" )
464+
465+ val zipped = os.zip(
466+ dest = wd / zipFileName,
467+ sources = List (source),
468+ followLinks = false
469+ )
470+
471+ val unzipped = os.unzip(
472+ source = zipped,
473+ dest = wd / " unzipped"
474+ )
475+
476+ import os .{shaded_org_apache_tools_zip => apache }
477+ val zipFile = new apache.ZipFile (zipped.toIO)
478+ val entry = zipFile.getEntry(linkName)
479+
480+ // check if zipped correctly as symlink
481+ assert(
482+ (entry.getUnixMode & apache.PermissionUtils .FILE_TYPE_FLAG ) == apache.UnixStat .LINK_FLAG
483+ )
484+ assert(os.isLink(unzipped / link))
485+ assert(os.readLink(unzipped / link) == os.readLink(source / link))
486+ }
487+
457488 test(" unzipStream" ) - prep { wd =>
458489 // Step 1: Create an in-memory ZIP file as a stream
459490 val zipStreamOutput = new ByteArrayOutputStream ()
You can’t perform that action at this time.
0 commit comments