Skip to content

Commit

Permalink
Merge pull request #52 from ctrliq/mirror-mirrorsync-link-fix
Browse files Browse the repository at this point in the history
Mirror Plugin: Fix mirror to mirror sync to handle new link format
  • Loading branch information
ikaneshiro authored Apr 2, 2024
2 parents 22386d0 + e0059c9 commit fc7a7ed
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions internal/plugins/mirror/pkg/mirrorrepository/mirrorsync.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"crypto/md5" //nolint:gosec
"encoding/hex"
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"
Expand Down Expand Up @@ -278,14 +277,7 @@ func (s *MirrorSyncer) Sync() error {
} else if rsync.FileMode(remoteFile.Mode).IsLNK() {
s.h.logger.Debug("Processing Link", "content", remoteFile.Link)

// Split first 3 path elements from link and take the rest as the reference.
split := strings.SplitN(remoteFile.Link, "/", 4)
if len(split) < 4 {
s.h.logger.Error("Failed to split link", "link", remoteFile.Link)
return fmt.Errorf("failed to split link: %q", remoteFile.Link)
}

link := s.h.generateFileReference(strings.ToLower(split[3]))
link := s.h.generateFileReference(strings.ToLower(remoteFile.Link))

// Add entry to DB
//nolint:gosec
Expand Down

0 comments on commit fc7a7ed

Please sign in to comment.