Skip to content

Commit a9de187

Browse files
Merge pull request #369 from r41d/noExtension
Handle edge case where image file was uploaded without an extension
2 parents 6776520 + 49ea752 commit a9de187

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ What if you want to just have one folder with all photos, in chronological order
1313

1414
This script does just that - it organizes and cleans up your Takeout for you 🧹😌
1515

16-
It will take all of those folders, find all photos in them, set their and `file last modified` correctly, and put it in one big folder (or folders divided by a month) 🗄
16+
It will take all of those folders, find all photos in them, set their `file last modified` correctly, and put it in one big folder (or folders divided by a month) 🗄
1717

1818
## How to use:
1919
Since `v3.2.0`, `gpth` is interactive 🎉 - you don't need to type any complicated arguments - just get your takeout, run gpth, and follow prompted instructions 💃

lib/date_extractors/json_extractor.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ Future<File?> _jsonForFile(File file, {required bool tryhard}) async {
4040
// test: combining this with _shortenName?? which way around?
4141
_bracketSwap,
4242
_removeExtra,
43+
_noExtension,
4344
// use those two only with tryhard
4445
// look at https://github.com/TheLastGimbus/GooglePhotosTakeoutHelper/issues/175
4546
// thanks @denouche for reporting this!
@@ -54,6 +55,13 @@ Future<File?> _jsonForFile(File file, {required bool tryhard}) async {
5455
return null;
5556
}
5657

58+
// if the originally file was uploaded without an extension,
59+
// (for example, "20030616" (jpg but without ext))
60+
// it's json won't have the extension ("20030616.json"), but the image
61+
// itself (after google proccessed it) - will ("20030616.jpg" tadam)
62+
String _noExtension(String filename) =>
63+
p.basenameWithoutExtension(File(filename).path);
64+
5765
String _removeDigit(String filename) =>
5866
filename.replaceAll(RegExp(r'\(\d\)\.'), '.');
5967

lib/grouping.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ extension Group on Iterable<Media> {
3636

3737
/// Removes duplicate media from list of media
3838
///
39-
/// This is ment to be used *early*, and it's aware of un-merged albums.
39+
/// This is meant to be used *early*, and it's aware of un-merged albums.
4040
/// Meaning, it will leave duplicated files if they have different
4141
/// [Media.albums] value
4242
///

0 commit comments

Comments
 (0)