Skip to content

Commit 32c1dc6

Browse files
committed
fix: update modal banner upload & precommit
1 parent 739d4a3 commit 32c1dc6

3 files changed

Lines changed: 34 additions & 31 deletions

File tree

package-lock.json

Lines changed: 28 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/install-hooks.mjs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ try {
2020

2121
const hooksDir = join(root, '.git', 'hooks');
2222
mkdirSync(hooksDir, { recursive: true });
23-
writeFileSync(join(hooksDir, 'pre-commit'), '#!/bin/sh\nnpm run precommit\n');
23+
const hookScript =
24+
'#!/bin/sh\nnode -e "require(\'child_process\').execSync(\'npm run precommit\', {stdio:\'inherit\', shell:true})"\n';
25+
writeFileSync(join(hooksDir, 'pre-commit'), hookScript);
2426
chmodSync(join(hooksDir, 'pre-commit'), '755');
2527
console.log('[hooks] pre-commit installed');

server/routes/uploads.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { getUserById, updateUserSettings } from '../db/users.js';
22
import express from 'express';
3+
import path from 'path';
34
import multer from 'multer';
45
import requireAuth from '../middleware/auth.js';
56
import { capture } from '../utils/posthog.js';
@@ -278,7 +279,8 @@ router.post(
278279
}
279280

280281
const timestamp = Date.now();
281-
const filename = `updateModalBanner${timestamp}`;
282+
const ext = path.extname(file.originalname) || '.png';
283+
const filename = `updateModalBanner${timestamp}${ext}`;
282284

283285
const formData = new FormData();
284286
formData.append('image', file.buffer, filename);

0 commit comments

Comments
 (0)