Skip to content

Build your personal knowledge base with Trilium Notes

image notes can't be updated + minor visual tweaks

azivner39b3c91abfb9
diff --git a/db/migrations/0116__add_indexes.sql b/db/migrations/0116__add_indexes.sql
new file mode 100644
index 0000000000..32bec32477
--- /dev/null
+++ b/db/migrations/0116__add_indexes.sql
@@ -0,0 +1,14 @@
+create index IDX_links_noteId_index
+ on links (noteId);
+
+create index IDX_links_targetNoteId_index
+ on links (targetNoteId);
+
+create index IDX_attributes_name_index
+ on attributes (name);
+
+create index IDX_attributes_noteId_index
+ on attributes (noteId);
+
+create index IDX_attributes_value_index
+ on attributes (value);
diff --git a/src/public/javascripts/services/note_detail_file.js b/src/public/javascripts/services/note_detail_file.js
index bdfdd3955d..342df3e31c 100644
--- a/src/public/javascripts/services/note_detail_file.js
+++ b/src/public/javascripts/services/note_detail_file.js
@@ -19,8 +19,8 @@ async function show() {
$component.show();
- $fileName.text(attributeMap.originalFileName);
- $fileSize.text(attributeMap.fileSize + " bytes");
+ $fileName.text(attributeMap.originalFileName || "?");
+ $fileSize.text((attributeMap.fileSize || "?") + " bytes");
$fileType.text(currentNote.mime);
}
diff --git a/src/public/javascripts/services/note_detail_image.js b/src/public/javascripts/services/note_detail_image.js
index c6298094ab..ea5a1d46f7 100644
--- a/src/public/javascripts/services/note_detail_image.js
+++ b/src/public/javascripts/services/note_detail_image.js
@@ -21,8 +21,8 @@ async function show() {
$component.show();
- $fileName.text(attributeMap.originalFileName);
- $fileSize.text(attributeMap.fileSize + " bytes");
+ $fileName.text(attributeMap.originalFileName || "?");
+ $fileSize.text((attributeMap.fileSize || "?") + " bytes");
$fileType.text(currentNote.mime);
$imageView.prop("src", `/api/images/${currentNote.noteId}/${currentNote.title}`);
diff --git a/src/services/notes.js b/src/services/notes.js
index efbe27d6f6..60859d5510 100644
--- a/src/services/notes.js
+++ b/src/services/notes.js
@@ -275,8 +275,8 @@ async function updateNote(noteId, noteUpdates) {
throw new Error(`Note ${noteId} is not available for change!`);
}
- if (note.type === 'file') {
- // for update file, newNote doesn't contain file payloads
+ if (note.type === 'file' || note.type === 'image') {
+ // files and images are immutable, they can't be updated
noteUpdates.content = note.content;
}
diff --git a/src/views/details/file.ejs b/src/views/details/file.ejs
index 42043f5599..cf17eed9cc 100644
--- a/src/views/details/file.ejs
+++ b/src/views/details/file.ejs
@@ -1,7 +1,7 @@
<div id="note-detail-file" class="note-detail-component">
<table id="file-table">
<tr>
- <th>File name:</th>
+ <th>Original file name:</th>
<td id="file-filename"></td>
</tr>
<tr>
diff --git a/src/views/details/image.ejs b/src/views/details/image.ejs
index 9a7a501eaf..f2792698ff 100644
--- a/src/views/details/image.ejs
+++ b/src/views/details/image.ejs
@@ -1,5 +1,5 @@
<div id="note-detail-image" class="note-detail-component">
- <strong>File name:</strong>
+ <strong>Original file name:</strong>
<span id="image-filename"></span>
&nbsp; &nbsp;