Skip to content

Commit e88bec4

Browse files
authored
bug(download): Properly namespace output_id for render.download in modules (#1732)
1 parent 63daf3a commit e88bec4

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6060

6161
* `shiny create` now uses the template `id` rather than the directory name as the default directory. (#1666)
6262

63-
* `ui.Theme()` now works correctly on Windows when the theme requires Sass compilation. (thanks @yuuuxt, #1684)
63+
* `ui.Theme()` now works correctly on Windows when the theme requires Sass compilation. (Thanks, @yuuuxt!) (#1684)
6464

6565
* Fixed multiple input controllers (`InputSlider`, `InputDate`, `InputDateRange`, `InputCheckbox`, and `InputCheckboxGroup`) in `shiny.playwright.controller` to check the `width` property within the `style` attribute. (#1691, #1696, #1702)
6666

@@ -76,6 +76,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7676

7777
* Fixed output controller `OutputDataFrame` in `shiny.playwright.controller` to correctly assert the number of rows in `.expect_nrow()` as the total number of virtual rows, not the number of currently displaying rows. (#1719)
7878

79+
* Fixed issue where `@render.download` did not respect the module namespacing. (Thanks, @nsiicm0) (#1732)
7980

8081
## [1.1.0] - 2024-09-03
8182

shiny/render/_render.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,8 @@ def url() -> str:
688688
from urllib.parse import quote
689689

690690
session = require_active_session(None)
691-
return f"session/{quote(session.id)}/download/{quote(self.output_id)}?w="
691+
# All download urls must be fully namespaced
692+
return f"session/{quote(session.id)}/download/{quote(session.ns(self.output_id))}?w="
692693

693694
# Unlike most value functions, this one's name is `url`. But we want to get the
694695
# name from the user-supplied function.
@@ -705,7 +706,9 @@ def url() -> str:
705706
# have been started.
706707
session = get_current_session()
707708
if session is not None and not session.is_stub_session():
708-
session._downloads[self.output_id] = DownloadInfo(
709+
# All download objects are stored in the root session.
710+
# They must be fully namespaced
711+
session._downloads[session.ns(self.output_id)] = DownloadInfo(
709712
filename=self.filename,
710713
content_type=self.media_type,
711714
handler=fn,

0 commit comments

Comments
 (0)