Skip to content

Commit 5e4e1f1

Browse files
t3dotggclaude
andcommitted
fix(release): address review on the Linux packages workflow
The publish job no longer leaves its write token in the checkout while it runs wrangler, and it skips cleanly when CLOUDFLARE_ACCOUNT_ID is unset. The pkg.t3.codes Worker returns 404 for malformed percent-encoding instead of 500. The packaging README names the nightly command. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
1 parent 824474a commit 5e4e1f1

3 files changed

Lines changed: 16 additions & 4 deletions

File tree

‎.github/workflows/publish-linux-packages.yml‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ jobs:
4747
- name: Checkout packaging sources
4848
uses: actions/checkout@v6
4949
with:
50+
# Later steps run downloaded code (wrangler); gh gets GH_TOKEN explicitly.
51+
persist-credentials: false
5052
sparse-checkout: |
5153
.github/actions
5254
packaging/linux
@@ -56,9 +58,10 @@ jobs:
5658
env:
5759
LINUX_PACKAGES_GPG_PRIVATE_KEY: ${{ secrets.LINUX_PACKAGES_GPG_PRIVATE_KEY }}
5860
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
61+
CLOUDFLARE_ACCOUNT_ID: ${{ vars.CLOUDFLARE_ACCOUNT_ID }}
5962
run: |
6063
if [[ -z "$LINUX_PACKAGES_GPG_PRIVATE_KEY" || -z "$CLOUDFLARE_API_TOKEN" ||
61-
! -f packaging/linux/t3code-archive-keyring.asc ]]; then
64+
-z "$CLOUDFLARE_ACCOUNT_ID" || ! -f packaging/linux/t3code-archive-keyring.asc ]]; then
6265
echo "::warning::Linux packages are not set up yet. See packaging/linux/README.md."
6366
echo "ready=false" >> "$GITHUB_OUTPUT"
6467
else

‎infra/packages/src/worker.ts‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,15 @@ const POOL_PATH = /\/pool\/(v[0-9A-Za-z.-]+)\/([0-9A-Za-z._+~-]+\.(?:deb|rpm))$/
1717
// to the newest signed metadata without refetching on every request.
1818
const INDEX_CACHE_CONTROL = "public, max-age=300";
1919

20+
// Malformed percent-encoding is a missing file, not a server error.
21+
function decodeKey(pathname: string): string | null {
22+
try {
23+
return decodeURIComponent(pathname.slice(1));
24+
} catch {
25+
return null;
26+
}
27+
}
28+
2029
function indexHeaders(object: R2Object): Headers {
2130
const headers = new Headers({ "cache-control": INDEX_CACHE_CONTROL, etag: object.httpEtag });
2231
object.writeHttpMetadata(headers);
@@ -39,8 +48,8 @@ export default {
3948
const asset = releaseAssetUrl(url.pathname);
4049
if (asset) return Response.redirect(asset, 302);
4150

42-
const key = decodeURIComponent(url.pathname.slice(1));
43-
if (key === "" || key.endsWith("/") || key.includes("..")) {
51+
const key = decodeKey(url.pathname);
52+
if (key === null || key === "" || key.endsWith("/") || key.includes("..")) {
4453
return new Response("Not found\n", { status: 404 });
4554
}
4655
if (request.method === "HEAD") {

‎packaging/linux/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ AppImage, like the [AUR packages](../aur).
1212
## What a package installs
1313

1414
- The app in `/opt/t3code` (or `/opt/t3code-nightly`), started by
15-
`/usr/bin/t3code`. `chrome-sandbox` is setuid root, so the app starts with
15+
`/usr/bin/t3code` (or `/usr/bin/t3code-nightly`). `chrome-sandbox` is setuid root, so the app starts with
1616
the Chromium sandbox on hosts that restrict user namespaces, such as
1717
Ubuntu 24.04.
1818
- A desktop entry and icons.

0 commit comments

Comments
 (0)