mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
set note type/mime in PUT body to avoid http proxy slash reencoding, fixes #2419
This commit is contained in:
parent
ab550a1e8d
commit
97f7fe7b18
@ -133,9 +133,7 @@ export default class NoteTypeWidget extends NoteContextAwareWidget {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await server.put('notes/' + this.noteId
|
await server.put('notes/' + this.noteId + '/type', { type, mime });
|
||||||
+ '/type/' + encodeURIComponent(type)
|
|
||||||
+ '/mime/' + encodeURIComponent(mime));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async confirmChangeIfContent() {
|
async confirmChangeIfContent() {
|
||||||
|
@ -120,9 +120,8 @@ function protectNote(req) {
|
|||||||
|
|
||||||
function setNoteTypeMime(req) {
|
function setNoteTypeMime(req) {
|
||||||
// can't use [] destructuring because req.params is not iterable
|
// can't use [] destructuring because req.params is not iterable
|
||||||
const noteId = req.params[0];
|
const {noteId} = req.params;
|
||||||
const type = req.params[1];
|
const {type, mime} = req.body;
|
||||||
const mime = req.params[2];
|
|
||||||
|
|
||||||
const note = becca.getNote(noteId);
|
const note = becca.getNote(noteId);
|
||||||
note.type = type;
|
note.type = type;
|
||||||
|
@ -213,7 +213,7 @@ function register(app) {
|
|||||||
apiRoute(POST, '/api/notes/:parentNoteId/children', notesApiRoute.createNote);
|
apiRoute(POST, '/api/notes/:parentNoteId/children', notesApiRoute.createNote);
|
||||||
apiRoute(PUT, '/api/notes/:noteId/sort-children', notesApiRoute.sortChildNotes);
|
apiRoute(PUT, '/api/notes/:noteId/sort-children', notesApiRoute.sortChildNotes);
|
||||||
apiRoute(PUT, '/api/notes/:noteId/protect/:isProtected', notesApiRoute.protectNote);
|
apiRoute(PUT, '/api/notes/:noteId/protect/:isProtected', notesApiRoute.protectNote);
|
||||||
apiRoute(PUT, /\/api\/notes\/(.*)\/type\/(.*)\/mime\/(.*)/, notesApiRoute.setNoteTypeMime);
|
apiRoute(PUT, '/api/notes/:noteId/type', notesApiRoute.setNoteTypeMime);
|
||||||
apiRoute(GET, '/api/notes/:noteId/revisions', noteRevisionsApiRoute.getNoteRevisions);
|
apiRoute(GET, '/api/notes/:noteId/revisions', noteRevisionsApiRoute.getNoteRevisions);
|
||||||
apiRoute(DELETE, '/api/notes/:noteId/revisions', noteRevisionsApiRoute.eraseAllNoteRevisions);
|
apiRoute(DELETE, '/api/notes/:noteId/revisions', noteRevisionsApiRoute.eraseAllNoteRevisions);
|
||||||
apiRoute(GET, '/api/notes/:noteId/revisions/:noteRevisionId', noteRevisionsApiRoute.getNoteRevision);
|
apiRoute(GET, '/api/notes/:noteId/revisions/:noteRevisionId', noteRevisionsApiRoute.getNoteRevision);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user