From 20a48d82c8dd141d844defc26b740107253b848d Mon Sep 17 00:00:00 2001 From: Linux123123 Date: Fri, 27 Dec 2024 13:25:06 +0200 Subject: [PATCH 1/3] Fix archiverFileSystem --- go.mod | 2 +- go.sum | 4 ++-- server/filesystem/compress.go | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index 9323df01..f476e44d 100644 --- a/go.mod +++ b/go.mod @@ -33,7 +33,7 @@ require ( github.com/klauspost/pgzip v1.2.6 github.com/magiconair/properties v1.8.9 github.com/mattn/go-colorable v0.1.13 - github.com/mholt/archives v0.0.0-20241207175349-5e373c52f8aa + github.com/mholt/archives v0.0.0-20241226194006-fc8400ac3529 github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db github.com/patrickmn/go-cache v2.1.0+incompatible github.com/pkg/sftp v1.13.7 diff --git a/go.sum b/go.sum index 72756429..bdcf3a8a 100644 --- a/go.sum +++ b/go.sum @@ -263,8 +263,8 @@ github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d h1:5PJl274Y63IEHC+7izoQE9x6ikvDFZS2mDVS3drnohI= github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= -github.com/mholt/archives v0.0.0-20241207175349-5e373c52f8aa h1:SzCiDuxF6489FegHHZe/ktxpRIDhu5IemNnWlW1Fquo= -github.com/mholt/archives v0.0.0-20241207175349-5e373c52f8aa/go.mod h1:j/Ire/jm42GN7h90F5kzj6hf6ZFzEH66de+hmjEKu+I= +github.com/mholt/archives v0.0.0-20241226194006-fc8400ac3529 h1:XsFbmbdHgEXRCASoX0wlUi1Es+yTDhsmiUo2UVukmLs= +github.com/mholt/archives v0.0.0-20241226194006-fc8400ac3529/go.mod h1:j/Ire/jm42GN7h90F5kzj6hf6ZFzEH66de+hmjEKu+I= github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db h1:62I3jR2EmQ4l5rM/4FEfDWcRD+abF5XlKShorW5LRoQ= github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db/go.mod h1:l0dey0ia/Uv7NcFFVbCLtqEBQbrT4OCwCSKTEv6enCw= github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0= diff --git a/server/filesystem/compress.go b/server/filesystem/compress.go index c21b690d..09b2ccd2 100644 --- a/server/filesystem/compress.go +++ b/server/filesystem/compress.go @@ -85,7 +85,8 @@ func (fs *Filesystem) archiverFileSystem(ctx context.Context, p string) (iofs.FS // zip.Reader doesn't suffer from issue #330 and #310 according to local test (but they should be fixed anyway) return zip.NewReader(f, info.Size()) case archives.Archival: - return archives.ArchiveFS{Stream: io.NewSectionReader(f, 0, info.Size()), Format: ff, Context: ctx}, nil + // Returning pointer in neccessary, as only on pointer there is implementation of ReadDir method + return &archives.ArchiveFS{Stream: io.NewSectionReader(f, 0, info.Size()), Format: ff, Context: ctx}, nil case archives.Compression: return archiverext.FileFS{File: f, Compression: ff}, nil } From f7b330c25722bbf4ffa1c509e886e05dadc7d6b7 Mon Sep 17 00:00:00 2001 From: Linux123123 Date: Fri, 27 Dec 2024 15:43:04 +0200 Subject: [PATCH 2/3] Allow extraction of rar archives --- server/filesystem/compress.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/filesystem/compress.go b/server/filesystem/compress.go index 09b2ccd2..5d947721 100644 --- a/server/filesystem/compress.go +++ b/server/filesystem/compress.go @@ -84,7 +84,7 @@ func (fs *Filesystem) archiverFileSystem(ctx context.Context, p string) (iofs.FS // while ArchiveFS can't. // zip.Reader doesn't suffer from issue #330 and #310 according to local test (but they should be fixed anyway) return zip.NewReader(f, info.Size()) - case archives.Archival: + case archives.Extraction: // Returning pointer in neccessary, as only on pointer there is implementation of ReadDir method return &archives.ArchiveFS{Stream: io.NewSectionReader(f, 0, info.Size()), Format: ff, Context: ctx}, nil case archives.Compression: From f3fed4bd81f90ce28ff010beb5956b43a8d7216e Mon Sep 17 00:00:00 2001 From: Linux123123 Date: Sat, 28 Dec 2024 17:04:59 +0200 Subject: [PATCH 3/3] Fix typo and rephrase --- server/filesystem/compress.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/filesystem/compress.go b/server/filesystem/compress.go index 5d947721..63ec8830 100644 --- a/server/filesystem/compress.go +++ b/server/filesystem/compress.go @@ -85,7 +85,8 @@ func (fs *Filesystem) archiverFileSystem(ctx context.Context, p string) (iofs.FS // zip.Reader doesn't suffer from issue #330 and #310 according to local test (but they should be fixed anyway) return zip.NewReader(f, info.Size()) case archives.Extraction: - // Returning pointer in neccessary, as only on pointer there is implementation of ReadDir method + // Returning a pointer is necessary, as the ReadDir method is only implemented for pointers + // and it is used for walking the archive fs. return &archives.ArchiveFS{Stream: io.NewSectionReader(f, 0, info.Size()), Format: ff, Context: ctx}, nil case archives.Compression: return archiverext.FileFS{File: f, Compression: ff}, nil