According to PEP8[1]:
> A bare `except:` clause will catch SystemExit and KeyboardInterrupt
> exceptions, making it harder to interrupt a program with Control-C,
> and can disguise other problems.
Use more specific exceptions or `contextlib.suppress()` in case of
`try: ... except: pass`.
[1]: https://peps.python.org/pep-0008/#programming-recommendations
`ResponseError` is currently undefined. It manifests when an exception
is raised in the `try` block.
`ResponseError` was renamed[1] to `S3Error` in minio 7.0.0.
[1]: b81883a98e
This replaces occurrences of inline CSS that can be replaced directly
(equivalent style) with Bootstrap classes.
Inline styles are generally longer, are not cached, make implementing
CSP policies harder, etc.
This meant that for a repository with
LICENSES/
0BSD
GPL-2.0
only 0BSD was detected.
So keep allowing LICENSES/0BSD.jpeg,
but also don't break LICENSES/GPL-2.0.
We linked to and served .tar.asc but the archive link both said
.tar.gz and /linked/ to .tar.gz. We never linked to .tar, or even
exposed the possibility.
Links with /item/ result in 404s for the root directory. Remove /item/
so that links to the root directory work properly.
For example, this link on godocs.io is broken:
https://godocs.io/git.sr.ht/~sircmpwn/getopt#pkg-files
Right now the description gets set to an empty string if no input is
specified instead of "null". In comparison updating a repository handles
it correctly [1].
[1]: f3df3ac3f1/item/gitsrht/blueprints/manage.py (L120)
Adds a `Content-Type` header to image files.
This allows images to be rendered by the browser.
In particular, it allows SVGs to be used in READMEs.
I have restricted this feature to only work on image files for now,
but it might make sense to send this header for other file types as
well if we can reasonably assume that the browser is able to render
it, such as PDFs and XML documents.
The SQLAlchemy documentation doesn't state that the `name`
keyword-argument is required but on my setup without this patch
git.sr.ht crashes immediately on start.
This reverts commit b75d2f0e03.
This commit has some issues:
- It uses <ins>/<del> not for the content that was actually
added/removed (i.e. the diff), but for the line stats. I don't think
that helps accessibility, it might actually make it worse.
- It adds some CSS to apply text decoration to <ins>/<del>, but only
inside the `diff` class. However, the elements never occur inside the
`diff` class (see first item). The CSS is never used.
- Instead, the place where it was used (line stats) got unintended text
decoration applied, causing a follow-up commit which fixed this the
wrong way, causing yet more issues (fixed in next commit).
I think the one place where it would make sense to apply <ins>/<del> is
the diff itself, but that might be a more serious operation.
The mailmap file is consulted to obtain the canonical name/email of an
author or committer of a commit, or a tagger of a tag.
Signed-off-by: Sebastian <sebastian@sebsite.pw>
This is a partial revert of fd8cca2e. It fixes a bug where, for example, viewing
a README file on a blob page results in no bottom margin for <pre>s at all, and
no bottom padding on the body. Adding bottom padding to the body also improves
the experience on mobile.
Signed-off-by: Vlad-Stefan Harbuz <vlad@vladh.net>
Most URLs ending with a trailing slash currently 404, because the strict
mode is not properly disabled in the app.
The strict_slashes value must be set before adding the routes.
After this patch, requesting URLs with a trailing slash will work as
expected (eg git.sr.ht/~sircmpwn/git.sr.ht/)
Fix canonical_name, which was wrongly named canonicalName, in user
resources returned by the legacy API.
Also take the opportunity to refactor the GraphQL queries such that each
query retrieves only the data it needs.
Right now repos log page is the slowest page on git.sr.ht, and a big
reason for that is that it currently averages on 19 queries per view,
most of them coming from the template looking up users to show links to
their user pages. We can get all the users we have before that, and pass
that on to the template. With these changes, a page view always takes 5
queries consistently.
Add a 'visibility' enum type to the database and use it for the
repository.visibility column.
This required changes to scm.sr.ht code. Instead of updating scm.sr.ht,
most of the scm.sr.ht code that git.sr.ht uses was moved to git.sr.ht.