X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;f=src%2Fdb%2Fsqlite%2Findex.js;h=76309d6c039f623749b575b2f1b1b20f9fb212e5;hb=1d571ced238ac89098fa690bd35f5c9f58cb18f2;hp=31471bafb850c9d761ffc19931968658eb093258;hpb=c37d8040d243375b0344d605444d0614a4d5f5d7;p=websub-hub diff --git a/src/db/sqlite/index.js b/src/db/sqlite/index.js index 31471ba..76309d6 100644 --- a/src/db/sqlite/index.js +++ b/src/db/sqlite/index.js @@ -20,7 +20,7 @@ const schemaVersionsSupported = { max: { major: 1, minor: 0, - patch: 3, + patch: 4, }, }; @@ -759,7 +759,7 @@ class DatabaseSQLite extends Database { } - topicGetByUrl(dbCtx, topicUrl) { + topicGetByUrl(dbCtx, topicUrl, applyDefaults = true) { const _scope = _fileScope('topicGetByUrl'); this.logger.debug(_scope, 'called', { topicUrl }); @@ -767,7 +767,10 @@ class DatabaseSQLite extends Database { try { topic = this.statement.topicGetByUrl.get({ topicUrl }); DatabaseSQLite._topicDataToNative(topic); - return this._topicDefaults(topic); + if (applyDefaults) { + topic = this._topicDefaults(topic); + } + return topic; } catch (e) { this.logger.error(_scope, 'failed', { error: e, topic, topicUrl }); throw e; @@ -865,6 +868,8 @@ class DatabaseSQLite extends Database { const _scope = _fileScope('topicSetContent'); const topicSetContentData = { contentType: null, + httpETag: null, + httpLastModified: null, ...data, }; const logData = { @@ -881,7 +886,11 @@ class DatabaseSQLite extends Database { if (result.changes != 1) { throw new DBErrors.UnexpectedResult('did not set topic content'); } - result = this.statement.topicSetContentHistory.run({ topicId: data.topicId, contentHash: data.contentHash, contentSize: data.content.length }); + result = this.statement.topicSetContentHistory.run({ + topicId: data.topicId, + contentHash: data.contentHash, + contentSize: data.content.length, + }); if (result.changes != 1) { throw new DBErrors.UnexpectedResult('did not set topic content history'); }