mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-21 21:22:11 -03:00
fix(bulk-context-menu): escape special characters in data-filepath selector to support double quotes in filenames (#845)
This commit is contained in:
@@ -846,8 +846,14 @@ function setupLoraSpecificFields(filePath) {
|
||||
|
||||
const currentPath = resolveFilePath();
|
||||
if (!currentPath) return;
|
||||
const loraCard = document.querySelector(`.model-card[data-filepath="${currentPath}"]`) ||
|
||||
document.querySelector(`.model-card[data-filepath="${filePath}"]`);
|
||||
const escapedCurrentPath = window.CSS && typeof window.CSS.escape === 'function'
|
||||
? window.CSS.escape(currentPath)
|
||||
: currentPath.replace(/["\\]/g, '\\$&');
|
||||
const escapedFilePath = window.CSS && typeof window.CSS.escape === 'function'
|
||||
? window.CSS.escape(filePath)
|
||||
: filePath.replace(/["\\]/g, '\\$&');
|
||||
const loraCard = document.querySelector(`.model-card[data-filepath="${escapedCurrentPath}"]`) ||
|
||||
document.querySelector(`.model-card[data-filepath="${escapedFilePath}"]`);
|
||||
const currentPresets = parsePresets(loraCard?.dataset.usage_tips);
|
||||
|
||||
if (key === 'strength_range') {
|
||||
|
||||
@@ -49,7 +49,10 @@ function formatPresetKey(key) {
|
||||
*/
|
||||
window.removePreset = async function(key) {
|
||||
const filePath = document.querySelector('#modelModal .modal-content .file-path').dataset.filepath;
|
||||
const loraCard = document.querySelector(`.model-card[data-filepath="${filePath}"]`);
|
||||
const escapedPath = window.CSS && typeof window.CSS.escape === 'function'
|
||||
? window.CSS.escape(filePath)
|
||||
: filePath.replace(/["\\]/g, '\\$&');
|
||||
const loraCard = document.querySelector(`.model-card[data-filepath="${escapedPath}"]`);
|
||||
const currentPresets = parsePresets(loraCard.dataset.usage_tips);
|
||||
|
||||
delete currentPresets[key];
|
||||
|
||||
Reference in New Issue
Block a user