Skip to content

Commit 87afb30

Browse files
committed
Updating to deal with 404
1 parent 30fc4f7 commit 87afb30

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

shiny/ui/_include_helpers.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ def check_path(path: Path | str) -> Path:
197197
def create_include_dependency(
198198
name: str, path: str, include_files: bool
199199
) -> tuple[HTMLDependency, str]:
200+
print("create include: ", name, os.path.dirname(path))
200201
dep = HTMLDependency(
201202
name,
202203
DEFAULT_VERSION,
@@ -216,7 +217,7 @@ def maybe_copy_files(path: Path | str, include_files: bool) -> tuple[str, str]:
216217
hash = get_hash(path, include_files)
217218
print("path: ", path, "Hash: ", hash)
218219

219-
tmpdir = os.path.join(tempfile.gettempdir(), f"shiny_include_files_{hash}")
220+
tmpdir = os.path.join(tempfile.gettempdir(), f"shiny_include_{hash}")
220221
path_dest = os.path.join(tmpdir, os.path.basename(path))
221222
print("tmpdir: ", tmpdir, "path_dest: ", path_dest)
222223

@@ -229,7 +230,7 @@ def maybe_copy_files(path: Path | str, include_files: bool) -> tuple[str, str]:
229230
return path_dest, hash
230231

231232
# Otherwise, make sure we have a clean slate
232-
if os.path.exists(path_dest):
233+
if os.path.exists(tmpdir):
233234
print("Folder already exists, but not files, removing.")
234235
shutil.rmtree(path_dest)
235236

@@ -243,14 +244,15 @@ def maybe_copy_files(path: Path | str, include_files: bool) -> tuple[str, str]:
243244
shutil.copytree(os.path.dirname(path), tmpdir)
244245

245246
else:
246-
os.makedirs(path_dest, mode=0o755, exist_ok=True)
247+
os.makedirs(tmpdir, exist_ok=True)
247248
print(
248249
"Copying files from: ",
249250
path,
250251
" with perms: ",
251252
oct(os.stat(path).st_mode),
252253
)
253254
shutil.copy(path, path_dest)
255+
254256
return path_dest, hash
255257

256258

tests/playwright/shiny/bugs/2061-css-js-inclusion/include_files_case/css/style.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,5 @@ h1 {
1717
border-radius: 5px;
1818
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
1919
}
20+
21+
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
const newParagraph = document.createElement('p');
22
newParagraph.textContent = 'Heyo!';
3-
const bodyElement = document.body;
4-
bodyElement.appendChild(newParagraph);
3+
document.body.appendChild(newParagraph);
4+
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
const newParagraph = document.createElement('p');
22
newParagraph.textContent = 'Heyo!';
3-
const bodyElement = document.body;
4-
bodyElement.appendChild(newParagraph);
3+
document.body.appendChild(newParagraph);

0 commit comments

Comments
 (0)