anyflip-downloader icon indicating copy to clipboard operation
anyflip-downloader copied to clipboard

panic: runtime error: index out of range [193] with length 193

Open gian9959 opened this issue 1 year ago • 4 comments

When trying to dowload a specific file I get this runtime error:

panic: runtime error: index out of range [193] with length 193
goroutine 1 [running]:
main.prepareDownload(0xc00018e900)
	/home/runner/work/anyflip-downloader/anyflip-downloader/main.go:106 +0x43c
main.main()
	/home/runner/work/anyflip-downloader/anyflip-downloader/main.go:52 +0x1c

Tried both on Linux and Windows, tried compiling from source and using the release. Does not happen with any other file I tried downloading, only with this specific one.

gian9959 avatar Sep 25 '23 23:09 gian9959

The file I am trying to download has 258 pages, but weirdly there are only 193 jpgs names listed in the config.js on the website. Infact, if I try to load the thumbnails of the pages on AnyFlip, the thumbnails only load up to page 193. The "pageFilesNames" array has therefore only 193 jpgs names, but the function prepareDownload in main gets called 258 times, because that's the lenght of the document in theory.

gian9959 avatar Sep 26 '23 21:09 gian9959

I managed to download the file by appending a slice with the names of the other pages starting from 194.jpg to "pageFilesNames". Apparently, the missing page names were replaced by the standard page number names after page 193. So this Issue is just to let people know that there are documents on AnyFlip that have both pages with random names and number names.

gian9959 avatar Sep 26 '23 22:09 gian9959

Sorry for replying so late. Interesting. If you by any chance still have the config.js file for this book, I would be happy to have a look at it and see if I can find a solution for this issue.

Lofter1 avatar Oct 09 '23 22:10 Lofter1

I got the same problem, but this way

panic: runtime error: index out of range [1] with length 1 goroutine 1 [running]: main.sanitizeURL(0xc00013ea20) /home/runner/work/anyflip-downloader/anyflip-downloader/main.go:116 +0xf4 main.prepareDownload(0xc00013ea20) /home/runner/work/anyflip-downloader/anyflip-downloader/main.go:78 +0x46 main.main() /home/runner/work/anyflip-downloader/anyflip-downloader/main.go:52 +0x1c5 I don’t know which command to put but my file has 121 pages. If anyone can help me.

Fra-cyber-9 avatar Nov 24 '23 21:11 Fra-cyber-9