Fix Issue 589

Hi,
This is small fi for issue https://github.com/gogits/gogs/issues/589.
Thanks.