Deploy and schema updates for testing

This commit is contained in:
Max committed 2026-11-03 11:48:06 -07:00
1 parent 8d60aae65c
commit 81b4162117
8 files changed
+389 -86

No files matched your search

+18
View File
@@ -288,11 +288,18 @@ Attachment.generateThumbnail = (fileName) => {
Attachment.scanTextForWebsites = (userId, noteId, noteText) => {
const ScrapeQueue = require('@workers/ScrapeQueue')
const Schema = require('@helpers/Schema')
// Fixed: the old version called resolve() without returning, so an empty
// note fell through and ran the DB lookup anyway.
if (!noteText || noteText.length == 0) { return Promise.resolve('') }
// When the scrape schema is absent the new columns do not exist, so
// creating a pending row would fail on every save. The diff and soft-delete
// below still run - they touch no new columns - so removing a link from a
// note behaves exactly as before.
const scrapeAvailable = Schema.isScrapeSchemaReady()
let knownText = ''
return Attachment.urlForNote(userId, noteId)
@@ -320,6 +327,10 @@ Attachment.scanTextForWebsites = (userId, noteId, noteText) => {
if (!remaining.length) { return knownText }
// No schema, no previews. Return what is already cached rather than
// attempting inserts that cannot succeed.
if (!scrapeAvailable) { return knownText }
// Create a shell row per new URL, then hand off to the worker.
return Promise.all(remaining.map(url =>
Attachment.createPendingUrlAttachment(userId, noteId, url)
@@ -378,8 +389,10 @@ Attachment.createPendingUrlAttachment = (userId, noteId, url) => {
Attachment.scrapeUrlsCreateAttachments = (userId, noteId, foundUrls) => {
const ScrapeQueue = require('@workers/ScrapeQueue')
const Schema = require('@helpers/Schema')
if (!foundUrls || !foundUrls.length) { return Promise.resolve('') }
if (!Schema.isScrapeSchemaReady()) { return Promise.resolve('') }
return Promise.all(foundUrls.map(url =>
Attachment.createPendingUrlAttachment(userId, noteId, url)
@@ -562,6 +575,11 @@ Attachment.getPushkeyBookmarklet = (userId) => {
Attachment.pushUrl = (pushkey, url) => {
const ScrapeQueue = require('@workers/ScrapeQueue')
const Schema = require('@helpers/Schema')
// Preserve the bookmarklet contract - resolve truthy, leaking nothing -
// rather than failing an insert against columns that do not exist.
if (!Schema.isScrapeSchemaReady()) { return Promise.resolve(true) }
let userId = null
pushkey = String(pushkey || '').replace(/ /g, '+')