Skip to content

Commit 4ec2291

Browse files
committed
fix: #128 Parenthesis Name Only Error?
1 parent af4e8be commit 4ec2291

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

cmdupload/e2e_upload_folder_test.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,21 @@ func Test_Issue_129(t *testing.T) {
310310
runCase(t, tc)
311311
}
312312

313+
func Test_Issue_128(t *testing.T) {
314+
315+
tc := testCase{
316+
name: "Test_Issue_128",
317+
args: []string{
318+
"-google-photos",
319+
"../../test-data/Issue 128",
320+
},
321+
resetImmich: true,
322+
expectError: false,
323+
APITrace: false,
324+
}
325+
runCase(t, tc)
326+
}
327+
313328
// ResetImmich
314329
// ⛔: will remove the content of the server.‼️
315330
// Give the user of the connection to confirm the server instance: debug@example.com

docs/releases.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
## Release next
44

5+
### fix: #128 Parenthesis Name Only Error?
6+
Some google photos users have lot of files named .jpg, (1).jpg, (x).jpg. Those names aren't makes immich-server crashing or timeout.
7+
When such files are encountered, they are now uploaded with the name "No Name".
58

69
### fix: #125 XMP filenames don't always match what is expected
710

immich/asset.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,18 @@ func (ic *ImmichClient) AssetUpload(ctx context.Context, la *browser.LocalAssetF
6060
return
6161
}
6262
assetType := strings.ToUpper(strings.Split(mtype[0], "/")[0])
63+
ext := path.Ext(la.Title)
64+
if strings.TrimSuffix(la.Title, ext) == "" {
65+
la.Title = "No Name" + ext // fix #88, #128
66+
}
6367

6468
m.WriteField("deviceAssetId", fmt.Sprintf("%s-%d", path.Base(la.Title), s.Size()))
6569
m.WriteField("deviceId", ic.DeviceUUID)
6670
m.WriteField("assetType", assetType)
6771
m.WriteField("fileCreatedAt", la.DateTaken.Format(time.RFC3339))
6872
m.WriteField("fileModifiedAt", s.ModTime().Format(time.RFC3339))
6973
m.WriteField("isFavorite", myBool(la.Favorite).String())
70-
m.WriteField("fileExtension", path.Ext(la.FileName))
74+
m.WriteField("fileExtension", ext)
7175
m.WriteField("duration", formatDuration(0))
7276
m.WriteField("isReadOnly", "false")
7377
// m.WriteField("isArchived", myBool(la.Archived).String()) // Not supported by the api

0 commit comments

Comments
 (0)