Skip to content

fix(image-server): fix issue where images didn't get a localhost url when server was paused#7518

Open
jrainville wants to merge 1 commit into
release/10.34.xfrom
fix/image-received-in-bg
Open

fix(image-server): fix issue where images didn't get a localhost url when server was paused#7518
jrainville wants to merge 1 commit into
release/10.34.xfrom
fix/image-received-in-bg

Conversation

@jrainville
Copy link
Copy Markdown
Member

Background Image URL Fix Summary

status-app PR: status-im/status-app#21127

Problem

When the app returned from background, message image URLs could be generated as relative paths like qrc:/messages/images?messageId=..., which QML treated as a resource path instead of a local media-server URL.
This prevented images from settling after fallback/retry.

Root Cause

When the media server listener was stopped during background transition, server address state became nil.
URL generation depended on that active address, so base URL resolution could collapse to empty, producing relative /messages/... paths.

Fix Applied

Updated server URL resolution logic so image URLs remain absolute even when the listener is temporarily stopped.

  • Updated host/port fallback logic in:
    • server.go

Behavior after fix:

  • Prefer active listener address when available.
  • If listener is not active, fall back to configured bind address and cached/static port.
  • Build absolute base URL from resolved host+port.
  • Only return empty base URL when host/port truly cannot be resolved.

Tests

Regression tests were added/kept to verify stopped-server URL generation remains absolute:

  • server_test.go

Focused suite run:

  • go test ./server -run TestServerURLSuite
  • Result: pass

Result

Message image URLs now retain the expected format after background/foreground flow, for example:
https://localhost:PORT/messages/images?messageId=...
instead of qrc:/messages/images?messageId=...

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 3, 2026

⚠️ Companion PR Needs Update

#21127 is not using the latest status-go commit (a3a61b86ce7bb5eaebf8a5fd8f1ab722d7198ef8).

Update vendor/status-go in the companion PR.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes media server URL generation so that image/media URLs remain absolute even when the server listener is temporarily stopped (e.g., during background/pause), avoiding relative /messages/... paths that QML can misinterpret.

Changes:

  • Updated GetAddrPort() to resolve host from either the active listener address or configured bind address when the listener is stopped.
  • Updated GetPort() to fall back to cachedPort (and then configured port) when the listener address is unavailable.
  • Updated MakeBaseURL() to use the resolved host:port (instead of depending directly on s.address).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread server/server.go
@status-im-auto
Copy link
Copy Markdown
Member

status-im-auto commented Jun 3, 2026

Jenkins Builds

Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 44c8d4b 1 2026-06-03 21:38:15 ~5 min linux/status-go 📦zip
✔️ 44c8d4b 1 2026-06-03 21:40:31 ~7 min macos/status-go 📦zip
✔️ 44c8d4b 1 2026-06-03 21:41:18 ~8 min windows/status-go 📦zip
✔️ 44c8d4b 1 2026-06-03 21:51:27 ~18 min tests-rpc 📄log
✔️ 44c8d4b 1 2026-06-03 22:12:10 ~39 min tests 📄log
✔️ a3a61b8 2 2026-06-03 21:47:48 ~3 min linux/status-go 📦zip
✔️ a3a61b8 2 2026-06-03 21:47:51 ~3 min macos/status-go 📦zip
✔️ a3a61b8 2 2026-06-03 21:52:09 ~7 min windows/status-go 📦zip
✔️ a3a61b8 2 2026-06-03 22:06:30 ~14 min tests-rpc 📄log
✔️ a3a61b8 2 2026-06-03 22:45:25 ~33 min tests 📄log

@jrainville jrainville force-pushed the fix/image-received-in-bg branch from 44c8d4b to a3a61b8 Compare June 3, 2026 21:43
@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (release/10.34.x@7db3f14). Learn more about missing BASE report.

Additional details and impacted files
@@                Coverage Diff                 @@
##             release/10.34.x    #7518   +/-   ##
==================================================
  Coverage                   ?   61.27%           
==================================================
  Files                      ?      851           
  Lines                      ?   119282           
  Branches                   ?        0           
==================================================
  Hits                       ?    73095           
  Misses                     ?    38694           
  Partials                   ?     7493           
Flag Coverage Δ
functional 40.32% <43.47%> (?)
unit 55.23% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
server/server.go 83.64% <100.00%> (ø)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Android] Receiving images while the app is in the background doesn't resolve

3 participants