mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
Fix SQL comment handling
This commit is contained in:
parent
af053b61fc
commit
1fc23c948e
@ -33,13 +33,14 @@ function execute(req) {
|
||||
for (let query of queries) {
|
||||
query = query.trim();
|
||||
|
||||
if (!query) {
|
||||
continue;
|
||||
}
|
||||
|
||||
while (query.startsWith('-- ') {
|
||||
// Query starts with one or more SQL comments, discard these before we execute.
|
||||
query = query.substr(query.indexOf('\n') + 1)
|
||||
const pivot = query.indexOf('\n');
|
||||
query = pivot > 0 ? query.substr(pivot + 1).trim() : "";
|
||||
}
|
||||
|
||||
if (!query) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (query.toLowerCase().startsWith('select') || query.toLowerCase().startsWith('with')) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user