Spaces:
Running
Running
toykity commited on
Commit ·
b5d9fa9
1
Parent(s): f56f493
fix: syntax error in start.sh integration service patch
Browse files185 unmodified lines1861871881891901911921931941951961971989 unmodified lines208209210211212213214215216217218219220221222223224225226227228185 unmodified linesnode -e "const fs = require('fs');let code = fs.readFileSync('$STORAGE_TARGET', 'utf8');// Add logging to uploadSimpleconst oldUpload = 'async uploadSimple(path){';const newUpload = 'async uploadSimple(path){console.log(\"[uploadSimple] fetching:\",path);';if (code.includes(oldUpload)) {code = code.replace(oldUpload, newUpload);// Also add error loggingconst oldThrow = \"throw new Error('Unsupported file type.');";const newThrow = \"console.error('[uploadSimple] Unsupported file type for:', path);throw new Error('Unsupported file type.');\";code = code.replace(oldThrow, newThrow);fs.writeFileSync('$STORAGE_TARGET', code);9 unmodified linesINTEG_SVC_TARGET="$PATCH_DIR/apps/backend/dist/libraries/nestjs-libraries/src/database/prisma/integrations/integration.service.js"if [ -f "$INTEG_SVC_TARGET" ]; thenecho "Patching $INTEG_SVC_TARGET for resilient picture upload..."node -e "const fs = require('fs');let code = fs.readFileSync('$INTEG_SVC_TARGET', 'utf8');// Replace: await this.storage.uploadSimple(picture)// With: try-catch that logs and falls back to original URLconst oldPattern = 'await this.storage.uploadSimple(picture)';const newPattern = \"(await (async()=>{try{const r=await this.storage.uploadSimple(picture);console.log('[int-svc] uploaded picture:',r);return r}catch(e){console.error('[int-svc] uploadSimple failed for',picture,':',e.message);return picture}})())\";if (code.includes(oldPattern)) {code = code.replace(oldPattern, newPattern);fs.writeFileSync('$INTEG_SVC_TARGET', code);console.log('Integration service picture upload patched with try-catch fallback');} else {console.log('Integration service pattern not found, skipping');}"fi# Patch youtube.provider.js to remove youtubepartner scope (restricted, most users won't have it)185 unmodified lines1861871881891901911921931941951969 unmodified lines206207208209210211212213214215216217218219220221222223224225226227185 unmodified linesnode -e "const fs = require('fs');let code = fs.readFileSync('$STORAGE_TARGET', 'utf8');const oldUpload = 'async uploadSimple(path){';const newUpload = 'async uploadSimple(path){console.log(\"[uploadSimple] fetching:\",path);';if (code.includes(oldUpload)) {code = code.replace(oldUpload, newUpload);const oldThrow = \"throw new Error('Unsupported file type.');\";const newThrow = \"console.error('[uploadSimple] Unsupported file type for:', path);throw new Error('Unsupported file type.');\";code = code.replace(oldThrow, newThrow);fs.writeFileSync('$STORAGE_TARGET', code);9 unmodified linesINTEG_SVC_TARGET="$PATCH_DIR/apps/backend/dist/libraries/nestjs-libraries/src/database/prisma/integrations/integration.service.js"if [ -f "$INTEG_SVC_TARGET" ]; thenecho "Patching $INTEG_SVC_TARGET for resilient picture upload..."mkdir -p /app/patchescat > /app/patches/integ-svc.js << 'ISPATCH'const fs = require('fs');const target = process.argv[2];let code = fs.readFileSync(target, 'utf8');const oldPattern = 'await this.storage.uploadSimple(picture)';const newPattern = '(await(Promise.resolve().then(async()=>{try{const r=await this.storage.uploadSimple(picture);console.log("[int-svc] uploaded picture:",r);return r}catch(e){console.error("[int-svc] uploadSimple failed for",picture,":",e.message);return picture}})))';if (code.includes(oldPattern)) {code = code.replace(oldPattern, newPattern);fs.writeFileSync(target, code);console.log('Integration service picture upload patched with try-catch fallback');} else {console.log('Integration service pattern not found, skipping');}ISPATCHnode /app/patches/integ-svc.js "$INTEG_SVC_TARGET"fi# Patch youtube.provider.js to remove youtubepartner scope (restricted, most users won't have it)
var/docker/start.sh+9-10