redditSaver icon indicating copy to clipboard operation
redditSaver copied to clipboard

Various fixes

Open bcotton opened this issue 2 years ago • 8 comments

  • Fixed cross-platform file path handling
  • Added ability to handle 301 and 302 redirects
  • small fix for permaLink and UTF8 characters

bcotton avatar Dec 31 '22 00:12 bcotton

Thank you so much for all these contributions, all of them look like great improvements. I'll go through them individually and merge these soon. Quick Question - Does the pathing change break compatibility with existing path format (without ending slashes) in the settings file?

erohtar avatar Dec 31 '22 15:12 erohtar

Does the pathing change break compatibility with existing path format (without ending slashes) in the settings file?

Unsure, I'm testing on a mac. My path does not have a trailing slash.

bcotton avatar Dec 31 '22 21:12 bcotton

I did various tests today, and I can confirm that the pathing change works well and is backward compatible.

But I did face a problem and it's 100% repeatable for me right now. This error happens each time when downloading .json

SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at createNotes (xxx\redditSaver.js:57:19)
    at IncomingMessage.<anonymous> (xxx\redditSaver\redditSaver.js:33:3)
    at IncomingMessage.emit (node:events:525:35)
    at endReadableNT (node:internal/streams/readable:1358:12)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)

I checked the saved.json and it's always truncated at the same spot "awarders": [], "all_awardings": [], "locked": false, "author_flair_background_color": null, "collapsed_because_crowd_control": null, "mod_reports": [], "

The full saved.json shows this data right after the truncation "awarders": [], "all_awardings": [], "locked": false, "author_flair_background_color": null, "collapsed_because_crowd_control": null, "mod_reports": [], "quarantine": false, "mod_note": null

Any idea what's causing the problem?

erohtar avatar Jan 02 '23 21:01 erohtar

I'm having similar problems, but it will succeed about 25% of the time. It's something to do with the timing of the Promise, dunno.

Still looking into it.

bcotton avatar Jan 03 '23 16:01 bcotton

For me it was doing that 100% of the time yesterday at one point. Since then I have unsaved the latest posts/comments and saved some new ones and I can't recreate it right now - I wish I didn't make a change so I could keep looking into it, but my current json download doesn't give me an error. I'll make a release with most of your changes, except the promise and redirect ones - I figure the issue has to be in those somewhere.

erohtar avatar Jan 03 '23 16:01 erohtar

I pushed a new commit. This works for me, every time.

bcotton avatar Jan 05 '23 00:01 bcotton

Thank you for the update - pls allow me a couple days to use/test it and I'll merge with the main branch.

erohtar avatar Jan 05 '23 07:01 erohtar

I have been using your updated version for last few days and have seen no issues whatsoever. Just created a new release. Thank you again for all the improvements.

erohtar avatar Jan 10 '23 17:01 erohtar