Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mirror Plugin: Fix mirror to mirror sync to handle new link format #52

Merged
merged 1 commit into from
Apr 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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))
ikaneshiro marked this conversation as resolved.
Show resolved Hide resolved

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