Skip to content
This repository was archived by the owner on Jan 5, 2025. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/sdtools.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ function loadConfiguration(payload) {
}
else if (elem.classList.contains("sdFile")) { // File
var elemFile = document.getElementById(elem.id + "Filename");
elemFile.innerText = payload[key];
// Turn fake paths into file URIs
elemFile.innerText = decodeURIComponent(payload[key].replace("C:\\fakepath\\", "file:///"));
if (!elemFile.innerText) {
elemFile.innerText = "No file...";
}
Expand Down Expand Up @@ -124,11 +125,13 @@ function setSettings() {
payload[key] = elem.value;
if (!elem.value) {
// Fetch innerText if file is empty (happens when we lose and regain focus to this key)
payload[key] = elemFile.innerText;
// (don't forget to turn fake paths into file URIs).
payload[key] = decodeURIComponent(elemFile.innerText.replace("C:\\fakepath\\", "file:///"));
}
else {
// Set value on initial file selection
elemFile.innerText = elem.value;
// Set value on initial file selection (and turn fake paths to file URIs)
elemFile.innerText = decodeURIComponent(elem.value.replace("C:\\fakepath\\", "file:///"));
payload[key] = decodeURIComponent(elem.value.replace("C:\\fakepath\\", "file:///"));
}
}
else if (elem.classList.contains("sdList")) { // Dynamic dropdown
Expand Down