alfred-gitlab icon indicating copy to clipboard operation
alfred-gitlab copied to clipboard

Readme/Functionality Discrepancy

Open skoskie opened this issue 7 years ago • 0 comments

Just a quick note: As of v1.4.0, setting the URL is not an optional step.

I assume you default to the gitlab.com endpoint, which is what I am using, but this fails to fetch the projects. And yes, I gave the background process plenty of time to run. It only needed to fetch 4 projects.

Manually setting the URL to https://gitlab.com with or without the trailing slash also fails.

Setting the full path, "api_url": "https://gitlab.com/api/v4/projects", succeeds, returning the projects nearly instantly.


It seems like you already have the correct default ... https://github.com/lukewaite/alfred-gitlab/blob/82d36dca8402508593e670559bb06d8030404c68/src/update.py#L34

However, the initial value of the api_url key in settings.json is an empty string. I wonder if this is preventing the default value from being used.

I should note that I completely uninstalled the workflow and reinstalled it. I then turned on logging before ever invoking the workflow. Through it all, there is no line containing the phrase Setting API URL, as found here: https://github.com/lukewaite/alfred-gitlab/blob/d8184980f6e044af7e8f0092ae00b1f76a749c60/src/gitlab.py#L40

So I am fairly certain I never set the value to an empty string myself. I ended up setting the correct value directly in settings.json directly.


A URL sanity check might help. There is some great regex here: https://stackoverflow.com/a/7160778/338464


regex = re.compile(
        r'^(?:http)s?://' # http:// or https://
        r'(?:(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+(?:[A-Z]{2,6}\.?|[A-Z0-9-]{2,}\.?)|' #domain...
        r'localhost|' #localhost...
        r'\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})' # ...or ip
        r'(?::\d+)?' # optional port
        r'(?:/?|[/?]\S+)$', re.IGNORECASE)

Anyway, thanks for the excellent workflow and the work you have done on it.

skoskie avatar Mar 04 '18 19:03 skoskie