Skip to content

Commit a856f73

Browse files
committed
Merge pull request #152 from ntsklab/056-media
2 parents c3e405b + f3d57e6 commit a856f73

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

CHANGES.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,11 @@ To be released.
4848
- The current version string is displayed at the bottom of the dashboard page.
4949
[[#136], [#137] by RangHo Lee]
5050

51-
- Increased the maximum character limit for posts from 4,096 to 10,000 characters.
51+
- Increased the maximum character limit for posts from 4,096 to 10,000
52+
characters.
53+
54+
- EXIF metadata of attached images are now stripped before storing them
55+
to prevent privacy leaks. [[#152] by NTSK]
5256

5357
- Upgraded Fedify to 1.5.1 and *@fedify/postgres* to 0.3.0.
5458

@@ -67,6 +71,7 @@ To be released.
6771
[#130]: https://github.com/fedify-dev/hollo/pull/130
6872
[#136]: https://github.com/fedify-dev/hollo/issues/136
6973
[#137]: https://github.com/fedify-dev/hollo/pull/137
74+
[#152]: https://github.com/fedify-dev/hollo/pull/152
7075

7176

7277
Version 0.5.6

src/api/v1/media.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,14 @@ export async function postMedia(c: Context<{ Variables: Variables }>) {
3434
if (file.type.startsWith("video/")) {
3535
imageBytes = await makeVideoScreenshot(imageData);
3636
}
37-
const image = sharp(imageBytes);
38-
const fileMetadata = await image.metadata();
39-
const content = new Uint8Array(imageData);
37+
38+
const image = sharp(imageBytes).rotate();
39+
const rmMetaImage = await image.keepIccProfile().toBuffer();
40+
const fileMetadata = await sharp(rmMetaImage).metadata();
41+
const content = file.type.startsWith("video/")
42+
? new Uint8Array(imageData)
43+
: new Uint8Array(rmMetaImage);
44+
4045
const extension = mime.getExtension(file.type);
4146
if (!extension) {
4247
return c.json({ error: "Unsupported media type" }, 400);

0 commit comments

Comments
 (0)