docat icon indicating copy to clipboard operation
docat copied to clipboard

Improve http response when uploads fail due to broken tagged version

Open dgkf opened this issue 2 years ago • 1 comments

We encountered this on an internal deployment, but wanted to post a related bug report here for tracking.

We were trying to deploy to a tag that was "broken" (still not entirely sure what that means), and got the response

$ curl --request POST \
       --header "Docat-Api-Key: $TOKEN" \
       --form "[email protected]" \
       "http://www.mydocat.com/api/myproj/brokentag"

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>500 Internal Server Error</title>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.</p>

If it's possible to identify a broken tag, would it be possible to include response content that indicates that the issue is with the existing site contents for that tag?

dgkf avatar Oct 12 '21 17:10 dgkf

Thanks @dgkf for creating the issue.

A broken symlink refers here to something like this (when bar should link to foo but foo does not exist)

ln -s foo bar

I guess the main problem here is https://github.com/randombenj/docat/blob/master/docat/docat/utils.py#L17 and/or https://github.com/randombenj/docat/blob/master/docat/docat/app.py#L61 which allow you to setup broken symlinks.

And I am not sure if we should change that since it allows you fun things like creating the tag and uploading the version in parallel without race condition.

What definitely needs to be fixed here is the error message when you try to override this broken tag version. (Somewhere inside https://github.com/randombenj/docat/blob/master/docat/docat/app.py#L28 probably)

fliiiix avatar Oct 13 '21 10:10 fliiiix