Fix URL-encoded filenames in remote-build artifacts
Metadata
Current evaluation
Closed unmerged after canonical/craft-application#969 (commit 22184463) fixed URL decoding centrally for remote-build artifact filenames.
Resolution: closed superseded
Reason: The proposed charmcraft-specific override was superseded by the merged upstream fix in canonical/craft-application#969, which decodes remote-build filenames and converts %40 to @.
Evaluated by: mr-cal-bot
No scores available.
Issue body
Remote-build artifact filenames contain literal `%40` instead of `@` (e.g., `grafana-agent_ubuntu%4020.04-amd64.charm` instead of `grafana-agent_ubuntu@20.04-amd64.charm`).
## Changes
- Override `fetch_artifacts()` in `RemoteBuildService` to decode URL-encoded filenames using `urllib.parse.unquote()`
- Add unit tests verifying artifact filenames are properly decoded from Launchpad URLs
The issue originates in `craft-application` 6.0.1's base implementation which extracts filenames from URLs without decoding. This override provides a charmcraft-specific fix.
---
- [x] I've followed the [contribution guidelines](https://github.com/canonical/charmcraft/blob/main/CONTRIBUTING.md).
- [x] I've signed the [CLA](http://www.ubuntu.com/legal/contributors/).
- [x] I've successfully run `make lint && make test`.
- [ ] I've added or updated any relevant documentation.
- [ ] I've updated the relevant release notes.
> [!WARNING]
>
> <details>
> <summary>Firewall rules blocked me from connecting to one or more addresses (expand for details)</summary>
>
> #### I tried to connect to the following addresses, but was blocked by firewall rules:
>
> - `canonical-bos01.cdn.snapcraftcontent.com`
> - Triggering command: `/usr/lib/snapd/snapd /usr/lib/snapd/snapd` (dns block)
>
> If you need me to access, download, or install something from one of these locations, you can either:
>
> - Configure [Actions setup steps](https://gh.io/copilot/actions-setup-steps) to set up my environment, which run before the firewall is enabled
> - Add the appropriate URLs or hosts to the custom allowlist in this repository's [Copilot coding agent settings](https://github.com/canonical/charmcraft/settings/copilot/coding_agent) (admins only)
>
> </details>
<!-- START COPILOT CODING AGENT SUFFIX -->
<details>
<summary>Original prompt</summary>
----
*This section details on the original issue you should resolve*
<issue_title>remote-build results in filenames with literal `%40`</issue_title>
<issue_description>### Bug Description
When I remote-build grafana-agent-operator, the resulting filenames look as follows.
1. A literal `%40` is used instead of `@`.
2. Naming schema is inconsistent between log files and charms:
- `grafana-agent_ubuntu` vs `grafana_ubuntu` (`-agent` omitted)
- dash vs. `@`.
```
grafana-agent_ubuntu%4020.04-arm64.charm
grafana-agent_ubuntu%4022.04-amd64.charm
grafana-agent_ubuntu%4022.04-arm64.charm
grafana-agent_ubuntu%4024.04-amd64.charm
grafana-agent_ubuntu%4024.04-arm64.charm
grafana_ubuntu-20.04-amd64-2025-10-15T23:33:58.txt
grafana_ubuntu-20.04-arm64-2025-10-15T23:33:58.txt
grafana_ubuntu-22.04-amd64-2025-10-15T23:33:58.txt
grafana_ubuntu-22.04-arm64-2025-10-15T23:33:58.txt
grafana_ubuntu-24.04-amd64-2025-10-15T23:33:58.txt
grafana_ubuntu-24.04-arm64-2025-10-15T23:33:58.txt
```
### To Reproduce
1. Clone https://github.com/canonical/grafana-agent-operator/pull/337
2. `charmcraft remote-build --launchpad-accept-public-upload`
### Environment
Ubuntu 25.04
charmcraft 3.5.3 rev7286
### charmcraft.yaml
```yaml
# Copyright 2021-2025 Canonical Ltd.
# See LICENSE file for licensing details.
name: grafana-agent
type: charm
subordinate: true
description: A subordinate charm for Grafana Agent and an essential part of the COS Lite bundle.
summary: |
This Charmed Operator handles deployment, scaling, configuration, and Day 2 operations specific to Grafana Agent.
links:
documentation: https://discourse.charmhub.io/t/grafana-agent-docs-index/13452
website: https://charmhub.io/grafana-agent
source: https://github.com/canonical/grafana-agent-operator
issues: https://github.com/canonical/grafana-agent-operator/issues
platforms:
ubuntu@20.04:amd64:
ubuntu@20.04:arm64:
ubuntu@20.04:s390x:
ubuntu@20.04:ppc64el:
ubuntu@22.04:amd64:
ubuntu@22.04:arm64:
ubuntu@22.04:s390x:
ubuntu@22.04:ppc64el:
ubuntu@24.04:amd64:
ubuntu@24.04:arm64:
ubuntu@24.04:s390x:
ubuntu@24.04:ppc64el:
assumes:
- juju >= 3.6
parts:
charm:
# Uncomment the commented out portions of this part to build from source.
source: .
plugin: uv
# build-environment:
# - UV_NO_BINARY: "true"
# - MAKEOPTS: -j$(nproc) # Use all available cores for building pyyaml
# override-pull: |
# craftctl default
# rustup default 1.84
build-packages:
# - libffi-dev
# - libssl-dev
# - libyaml-dev
# - pkg-config
- git
build-snaps:
- astral-uv
# - rustup
override-build: |
craftctl default
git describe --always > $CRAFT_PART_INSTALL/version
cos-tool:
plugin: dump
source: https://github.com/canonical/cos-tool/releases/latest/download/cos-tool-${CRAFT_ARCH_BUILD_FOR}
source-type: file
permissions:
- path: cos-tool-${CRAFT_ARCH_BUILD_FOR}
mode: "755"
requires:
certificates:
interface: tls-certificates
limit: 1
optional: true
description: |
Certificate for the grafana agent server (API endpoint is served on :12345 by default)
to use to authenticate to clients, and the CA certificate of the signing CA.
We currently assume that the same CA signs all scrape targets (e.g. principal units).
juju-info:
description: |
`juju-info` provides basic compatibility with all charms.
If all you want is /var/log logs and node_exporter metrics,
this relation will be enough.
interface: juju-info
scope: container
optional: true
cos-agent:
description: |
`cos-agent` is a dedicated relation for the grafana agent machine
charm. It will allow you to set up custom scrape jobs, fetch files
from arbitrary locations, send alert rules, dashboards, etc.
interface: cos_agent
scope: container
optional: true
send-remote-write:
interface: prometheus_remote_write
optional: true
logging-consumer:
interface: loki_push_api
optional: true
grafana-cloud-config:
interface: grafana_cloud_config
limit: 1
optional: true
receive-ca-cert:
interface: certificate_transfer
optional: true
description: |
Obtain TLS information (certificate, ca, chain) from another charm.
tracing:
interface: tracing
limit: 1
optional: true
provides:
grafana-dashboards-provider:
interface: grafana_dashboard
optional: true
peers:
peers:
interface: grafana_agent_replica
config:
options:
classic_snap:
description: |
Choose whether to use the classic snap over the strictly confined
one. Defaults to "true".
type: boolean
default: true
tls_insecure_skip_verify:
description: |
Flag to skip the verification for insecure TLS.
If "true", self-signed certs can be seamlessly used; this setting
will be applied to all of th...
</details>
- Fixes canonical/charmcraft#2468
<!-- START COPILOT CODING AGENT TIPS -->
---
💬 We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey).
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed superseded | Closed unmerged after canonical/craft-application#969 (commit 22184463) fixed URL decoding centrally for remote-build artifact filenames. | |
| stealth/space-bunny-alpha | — | closed superseded | Unmerged workaround was closed after upstream craft-application PR #969 (commit 22184463) implemented the shared URL-filename decoding fix. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed. Submitted a fix to decode URL-encoded filenames in remote-build artifacts, replacing literal %40 with @. Added unit tests but was closed without explicit merge confirmation. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged fix overriding fetch_artifacts() to decode URL-encoded filenames in remote-build artifacts, replacing literal %40 with @. Resolves issue #2468 by applying urllib.parse.unquote() to Launchpad filenames and adding unit tests. |
Update history
No update history recorded yet.
Related work
-
Superseded By:
canonical/craft-application#969
(confidence 100%)
Merged as commit 22184463 with the shared URL-filename decoding fix.
-
Related To:
canonical/craft-application#968
(confidence 99%)
Upstream report of literal %40 in remote-build artifact filenames, resolved by #969.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #969 fix: decode filenames | craft-application | merged | Merged in canonical/craft-application#969 (commit 22184463), decoding remote-build artifact filenames so URL-encoded characters such as %40 are saved as @; fixes #968. |