{"action":"created","issue":{"url":"https://api.github.com/repos/Jermolene/TiddlyWiki5/issues/1418","labels_url":"https://api.github.com/repos/Jermolene/TiddlyWiki5/issues/1418/labels{/name}","comments_url":"https://api.github.com/repos/Jermolene/TiddlyWiki5/issues/1418/comments","events_url":"https://api.github.com/repos/Jermolene/TiddlyWiki5/issues/1418/events","html_url":"https://github.com/Jermolene/TiddlyWiki5/issues/1418","id":55421157,"number":1418,"title":"SaveTiddler/SaveTiddlers command doesn't handle images with uppercase extensions correctly","user":{"login":"dullroar","id":3743601,"avatar_url":"https://avatars.githubusercontent.com/u/3743601?v=3","gravatar_id":"","url":"https://api.github.com/users/dullroar","html_url":"https://github.com/dullroar","followers_url":"https://api.github.com/users/dullroar/followers","following_url":"https://api.github.com/users/dullroar/following{/other_user}","gists_url":"https://api.github.com/users/dullroar/gists{/gist_id}","starred_url":"https://api.github.com/users/dullroar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dullroar/subscriptions","organizations_url":"https://api.github.com/users/dullroar/orgs","repos_url":"https://api.github.com/users/dullroar/repos","events_url":"https://api.github.com/users/dullroar/events{/privacy}","received_events_url":"https://api.github.com/users/dullroar/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Jermolene/TiddlyWiki5/labels/bug","name":"bug","color":"e11d21"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-01-25T16:41:28Z","updated_at":"2015-01-28T17:33:48Z","closed_at":null,"body":"Depending on their source, many image files end up getting saved with uppercase file names and extensions, especially those from digital cameras using SD cards or similarly formatted media using FAT file systems (for example, my Canon uses `IMG_0001.JPG` naming format).\r\n\r\nIf these images are directly dragged and dropped using Explorer/Finder, they will work in general in terms of displaying them within the TW, but they will break the `SaveTiddlers` or `SaveTiddler` commands such as documented under [ExternalImages](http://tiddlywiki.com/#ExternalImages). The break is in `filesystemadaptor.js` at line 116 (v5.1.7):\r\n\r\n```javascript\r\nfs.writeFile(fileInfo.filepath,tiddler.fields.text,{encoding: typeInfo.encoding},function(err) {\r\n```\r\n\r\nThe breakage is caused because `typeInfo` is underfined for \"JPG\". Here is the entire stack trace:\r\n\r\n```\r\nsyncer-server: Dispatching 'save' task: Looking Down the Valley.JPG\r\n\r\n$:/plugins/tiddlywiki/filesystem/filesystemadaptor.js:116\r\n.writeFile(fileInfo.filepath,tiddler.fields.text,{encoding: typeInfo.encoding}\r\n                                                                    ^\r\nTypeError: Cannot read property 'encoding' of undefined\r\n    at $:/plugins/tiddlywiki/filesystem/filesystemadaptor.js:116:74\r\n    at FileSystemAdaptor.getTiddlerFileInfo ($:/plugins/tiddlywiki/filesystem/filesystemadaptor.js:76:3)\r\n    at FileSystemAdaptor.saveTiddler ($:/plugins/tiddlywiki/filesystem/filesystemadaptor.js:105:7)\r\n    at Syncer.dispatchTask ($:/core/modules/syncer.js:458:21)\r\n    at Syncer.processTaskQueue ($:/core/modules/syncer.js:401:9)\r\n    at null._onTimeout ($:/core/modules/syncer.js:380:26)\r\n    at Timer.listOnTimeout [as ontimeout] (timers.js:112:15)\r\n```\r\n\r\nA workaround is obviously to rename the extension to \"jpg\" or \"jpeg\", which does work. However, when importing lots of images from something like a camera that would be a PITA.\r\n\r\nI wonder if the fix would be to declare \"JPG\" and \"JPEG\" to also be supported extensions and simply extend the fix from commit 73a4747? Of course, that could argue that similar situations (\"GIF\", etc.) may have to be handled, and also that there is a limit (\"Jpg\", \"jPg\", \"jpG\", etc. would be explicitly ***not*** handled, although most of those would be rare cases)."},"comment":{"url":"https://api.github.com/repos/Jermolene/TiddlyWiki5/issues/comments/71878188","html_url":"https://github.com/Jermolene/TiddlyWiki5/issues/1418#issuecomment-71878188","issue_url":"https://api.github.com/repos/Jermolene/TiddlyWiki5/issues/1418","id":71878188,"user":{"login":"dullroar","id":3743601,"avatar_url":"https://avatars.githubusercontent.com/u/3743601?v=3","gravatar_id":"","url":"https://api.github.com/users/dullroar","html_url":"https://github.com/dullroar","followers_url":"https://api.github.com/users/dullroar/followers","following_url":"https://api.github.com/users/dullroar/following{/other_user}","gists_url":"https://api.github.com/users/dullroar/gists{/gist_id}","starred_url":"https://api.github.com/users/dullroar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dullroar/subscriptions","organizations_url":"https://api.github.com/users/dullroar/orgs","repos_url":"https://api.github.com/users/dullroar/repos","events_url":"https://api.github.com/users/dullroar/events{/privacy}","received_events_url":"https://api.github.com/users/dullroar/received_events","type":"User","site_admin":false},"created_at":"2015-01-28T17:33:48Z","updated_at":"2015-01-28T17:33:48Z","body":"I concur, but that means there are many places in the code that access the dictionary directly now, and there should instead be a \"wrapper\" they would use instead. Not terrible, just sprinkled in quite a few places from what I can see (luckily easily searchable). If you want, I could take a stab, since I seem to be finding (and in one case already fixing) all the \"case-aware-but-case-insensitive\" file system stuff."}}