diff --git a/frontend/dcViewer.js b/frontend/dcViewer.js
index 5455ce7..7bf0c6d 100644
--- a/frontend/dcViewer.js
+++ b/frontend/dcViewer.js
@@ -474,6 +474,23 @@ const normalizeModelSettingsSrc = (src) => {
return value.startsWith("uploads/") ? value : "";
};
+const normalizeCommentSourceSrc = (src) => {
+ if (!src || typeof src !== "string") return "";
+ let value = src.trim();
+ if (!value) return "";
+ try {
+ const parsed = new URL(value, window.location.href);
+ if (parsed.origin === window.location.origin) {
+ value = `${parsed.pathname}${parsed.search || ""}`;
+ } else if (/^https?:/i.test(value)) {
+ value = parsed.href;
+ }
+ } catch (_) {
+ // keep raw value
+ }
+ return value.replace(/^\/+/, "");
+};
+
const getModelSettingsSrc = (entry) => {
const meta = entry?.meta || {};
const candidates = [
@@ -557,9 +574,10 @@ const getCommentSourceForEntry = (entry = getPrimaryModelEntry()) => {
if (!entry) return null;
const meta = entry.meta || {};
const src = getModelSettingsSrc(entry) ||
- normalizeModelSettingsSrc(meta.sourceSrc) ||
- normalizeModelSettingsSrc(meta.artifactSrc) ||
- normalizeModelSettingsSrc(entry.src) ||
+ normalizeCommentSourceSrc(meta.sourceSrc) ||
+ normalizeCommentSourceSrc(meta.artifactSrc) ||
+ normalizeCommentSourceSrc(meta.settingsSrc) ||
+ normalizeCommentSourceSrc(entry.src) ||
"";
const uploadIdentity = extractUploadIdentityFromSrc(src);
return {
@@ -1296,8 +1314,9 @@ const applyCommentModal = async ({ closeOnSave = false } = {}) => {
const title = commentTitleInput?.value?.trim() || "";
const body = commentBodyInput?.value?.trim() || "";
const replyBody = commentReplyInput?.value?.trim() || "";
- if (!title && !body && !replyBody && !commentDraftAttachments.length && !commentReplyAttachments.length && !commentDraftSubitems.length && commentModalMode === "create") {
- if (commentModalError) commentModalError.textContent = "Добавьте заголовок, описание, комментарий или файл";
+ if (commentModalError) commentModalError.textContent = "";
+ if (commentModalMode === "create" && !commentContextTarget?.worldPos) {
+ if (commentModalError) commentModalError.textContent = "Не выбрана точка комментария";
return;
}
if (commentApplyButton) {
diff --git a/frontend/index.html b/frontend/index.html
index 53796d6..82c5180 100644
--- a/frontend/index.html
+++ b/frontend/index.html
@@ -573,6 +573,6 @@
-
+