mcdex
mcdex copied to clipboard
File table not found
When attempting to install a modpack, including through the example provided:
mcdex pack.install aoe age-of-engineering
An error message is provided and nothing else happens:
2020/12/19 13:08:36 no such table: files
However if I manually download the pack and put the unzipped file into the appropriate folder it appears to download everything fine, however it doesn't apply the overrides.
It seems the sqlite db is just plain missing the "files" table. For ref, the current as I write db file is files.mcdex.net/data/mcdex-v5-20210327.1521.dat.bz2 and clearly does not have the "files" table as expected, thus breaking things.
@dizzyd is the code that generates the mcdex.dat file open/avail somewhere on why it changed and broke?

After some more investigating, there are more issues than just that.
The latest release doesn't currently have the same functionality as a freshly built version.
Building from the current source code does not allow the command syntax above. Instead of the first argument being interpreted as a directory, it is interpreted as the pack name, specifically the slug. You cannot install a pack using the slug and a directory. Instead you need to specify the directory and the url. Alternatively you can just use the slug, to have it try to find the url. If you do the latter, you run into the same files table not found issue.
The lack of files table appears to be intentional based upon 138d2ddd03e24d7df0a6a1c5a19b9d97acbae9f5
Also, the current release allows you to just specify a directory, whereas a freshly built version does not. And the current release does not allow you to just specify a slug, but a freshly built version does.
I assume that this is due to this commit 460ba5c438ab19105b42d818ab9583bad2638fc7 which made it so it uses dir for the slug, rather than "url".
This also breaks the example of creating a pack and installing it via
mcdex pack.install mypack.
If you manually correct the files table not found issue by modifying the database to give it the files table, the next issue is the url generated. If it is given a file table, it generates a url for the modpack as something along the lines of: https://minecraft.curseforge.com/projects/%d/files/%d/download
This is also the kind of URL that is required to pass the "VALID URL PREFIXES"
Instead of downloading the pack file, we instead download a cloudfare page. This is in contrast to the individual mod downloads, which instead first fetch a page from a url like: https://addons-ecs.forgesvc.net/api/v2/addon/%d/file/%d which then returns a JSON string, which includes a URL to actually download the file like: https://edge.forgecdn.net/files/...
Both of these URLs would be deemed invalid URLs.
All of this makes me think the commit to remove storing the file id list didn't catch everything, as it didn't fix up retrieving a modpack.