Skip to content
Open
Show file tree
Hide file tree
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
17 changes: 11 additions & 6 deletions app/upload/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -422,18 +422,22 @@ func (uc *UpCmd) handleAsset(ctx context.Context, a *assets.Asset) error {
return nil
}

// uploadAsset uploads the asset to the server.
// set the server's asset ID to the asset.
// return the duplicate condition and error.
func (uc *UpCmd) uploadAsset(ctx context.Context, a *assets.Asset) (string, error) {
defer uc.app.Log().Debug("upload asset", "file", a)

// addCommandLineTags adds the --tag values and, if --session-tag is set, the session tag to the
// asset, so that manageAssetTags applies them on the server.
func (uc *UpCmd) addCommandLineTags(a *assets.Asset) {
if uc.SessionTag {
a.AddTag(uc.session)
}
for _, tag := range uc.Tags {
a.AddTag(tag)
}
}

// uploadAsset uploads the asset to the server.
// set the server's asset ID to the asset.
// return the duplicate condition and error.
func (uc *UpCmd) uploadAsset(ctx context.Context, a *assets.Asset) (string, error) {
defer uc.app.Log().Debug("upload asset", "file", a)

ar, err := uc.client.Immich.AssetUpload(ctx, a)
if err != nil {
Expand Down Expand Up @@ -570,6 +574,7 @@ func (uc *UpCmd) processUploadedAsset(ctx context.Context, a *assets.Asset, serv
// TODO: current version of Immich doesn't allow to add same tag to an asset already tagged.
// there is no mean to go the list of tagged assets for a given tag.
uc.manageAssetAlbums(ctx, a.File, a.ID, a.Albums)
uc.addCommandLineTags(a)
uc.manageAssetTags(ctx, a)
}
}
Expand Down
3 changes: 2 additions & 1 deletion internal/e2e/client/replace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ func Test_Replace(t *testing.T) {
"--no-ui",
"--api-trace",
"--log-level=debug",
"--tag=replaced", // must also reach the replacement uploads
"DATA/replace/high_quality",
})
err = c.ExecuteContext(ctx)
Expand All @@ -140,7 +141,7 @@ func Test_Replace(t *testing.T) {
e2eutils.CheckResults(t, map[fileevent.Code]int64{
fileevent.ProcessedUploadSuccess: 0,
fileevent.ProcessedAlbumAdded: 0,
fileevent.ProcessedTagged: 0,
fileevent.ProcessedTagged: 5,
fileevent.ProcessedUploadUpgraded: 5,
}, false, a.FileProcessor())

Expand Down