GitbookIO / nuts

:chestnut: Releases/downloads server with auto-updater and GitHub as a backend
http://nuts.gitbook.com
Apache License 2.0
1.25k stars 299 forks source link

Can't find default linux release #120

Open fredericlefeurmou opened 7 years ago

fredericlefeurmou commented 7 years ago

Nuts doesn't resolve the latest linux release while there is a stable release with a .deb.

https://my-domain/api/resolve:

{ "tag": "1.37.49", "channel": "stable", "notes": "", "published_at": "2016-12-15T03:23:24.000Z", "platforms": [ { "id": "2828651", "type": "linux_deb_64", "filename": "Q-Desktop_1.37.49_amd64.deb", "size": 38223736, "content_type": "application/vnd.debian.binary-package", "raw": { "url": "https://api.github.com/repos/fredericlefeurmou/release/releases/assets/2828651", "id": 2828651, "name": "Q-Desktop_1.37.49_amd64.deb", "label": null, "uploader": { "login": "fredericlefeurmou", "id": 1689073, "avatar_url": "https://avatars.githubusercontent.com/u/1689073?v=3", "gravatar_id": "", "url": "https://api.github.com/users/fredericlefeurmou", "html_url": "https://github.com/fredericlefeurmou", "followers_url": "https://api.github.com/users/fredericlefeurmou/followers", "following_url": "https://api.github.com/users/fredericlefeurmou/following{/other_user}", "gists_url": "https://api.github.com/users/fredericlefeurmou/gists{/gist_id}", "starred_url": "https://api.github.com/users/fredericlefeurmou/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/fredericlefeurmou/subscriptions", "organizations_url": "https://api.github.com/users/fredericlefeurmou/orgs", "repos_url": "https://api.github.com/users/fredericlefeurmou/repos", "events_url": "https://api.github.com/users/fredericlefeurmou/events{/privacy}", "received_events_url": "https://api.github.com/users/fredericlefeurmou/received_events", "type": "User", "site_admin": false }, "content_type": "application/vnd.debian.binary-package", "state": "uploaded", "size": 38223736, "download_count": 0, "created_at": "2016-12-15T03:16:39Z", "updated_at": "2016-12-15T03:17:44Z", "browser_download_url": "https://github.com/fredericlefeurmou/release/releases/download/1.37.49/Q-Desktop_1.37.49_amd64.deb" } } ] }

https://my-domain.com/download?platform=linux:

Version not found: latest

marcoancona commented 7 years ago

Same here

rahilsondhi commented 7 years ago

I think it has something to do with the detectPlatform method https://github.com/GitbookIO/nuts/blob/master/lib/utils/platforms.js#L30

It seems like that method will successfully get prefix: linux, but then since linux doesn't contain 32 or 64, it defaults to 32 for the suffix. So then nuts is looking for a release called linux_32, which doesn't exist (we only have the 64-bit versions).

I was able to write a simple test case @ https://github.com/GitbookIO/nuts/blob/master/test/platforms.js#L151 like this:

platforms.resolve(version, 'linux').filename.should.be.exactly('atom-amd64.deb');

# this fails with:
#   AssertionError: expected 'atom-ia32.tar.gz' to be 'atom-amd64.deb'