Commit Graph

17 Commits (108e2e28cd913a0c7f84344826db03775565d5e6)

Author SHA1 Message Date
Claire 879229e098 Fix error when rendering public pages with media attachments ()
* Add tests

* Fix error when rendering public pages with media attachments

* Add tests

* Fix tests

* Please CodeClimate
2021-10-13 15:27:19 +02:00
Claire 10918d97d4 Fix media attachment size validation not correctly accounting for file type ()
* Fix media attachment size validation not correctly accounting for file type

Fixes a regression introduced in  caused by the fact that kt-paperclip
now correctly runs validations before processing, meaning that file size
verification could not rely on our before_post_processing hook.

Moved the `before_post_processing` hooks to `before_validate` to make sure
the media attachment type is set correctly before the file gets validated.

* Add tests
2021-10-06 14:49:32 +01:00
Claire 7d0089033f Switch from unmaintained paperclip to kt-paperclip ()
* Switch from unmaintained paperclip to kt-paperclip

* Drop some compatibility monkey-patches not required by kt-paperclip

* Drop media spoof check monkey-patching

It's broken with kt-paperclip and hopefully it won't be needed anymore

* Fix regression introduced by paperclip 6.1.0

* Do not rely on pathname to call FastImage

* Add test for ogg vorbis file with cover art

* Add audio/vorbis to the accepted content-types

This seems erroneous as this would be the content-type for a vorbis stream
without an ogg container, but that's what the `marcel` gem outputs, so…

* Restore missing for_as_default method

* Refactor Attachmentable concern and delay Paperclip's content-type spoof check

Check for content-type spoofing *after* setting the extension ourselves, this
fixes a regression with kt-paperclip's validations being more strict than
paperclip 6.0.0 and rejecting some Pleroma uploads because of unknown
extensions.

* Please CodeClimate

* Add audio/vorbis to the unreliable set

It doesn't correspond to a file format and thus has no extension associated.
2021-09-29 23:52:36 +02:00
Eugen Rochko 930ba0630f Fix media attachments without file being uploadable ()
Fix 
2020-01-23 21:40:03 +01:00
Eugen Rochko 413cb7e861 Fix base64-encoded file uploads not being possible ()
Fix , Fix 
2020-01-04 01:54:07 +01:00
ThibG 479d8ff47a Fix remote media descriptions being cut off at 420 chars ()
* Fix remote media descriptions being cut off at 420 chars

Fixes 

* Fix tests
2019-11-04 13:00:16 +01:00
aus-social a53bcb6213 Lint pass () 2018-10-04 12:36:53 +02:00
Eugen Rochko 91aadec929 Resize images by area instead of fixed dimensions ()
To improve the way super tall or super ride images are treated, the
numbers remain the same, 1280x1280 and 400x400, but if an image
is less in one dimension than the other, the other can become larger

Thanks to @WAHa_06x36@mastodon.social for the tip
2018-07-28 03:33:00 +02:00
Eugen Rochko 9b7490cede Save video metadata and improve video OpenGraph tags ()
* Save metadata from video attachments, put correct dimensions into OG tags

* Add twitter:player for videos

* Fix code style and test
2018-02-16 07:22:20 +01:00
ysksn 321a4d35c6 Add tests for MediaAttachment ()
- `#local?`
- `#needs_redownload?`
- `#to_param`
2017-11-08 15:29:07 +09:00
unarist 4472c5723a Fix Cocaine::ExitStatusError when upload small non-animated GIF ()
Looks like copied tempfile need to be flushed before further processing. This issue won't happen if the uploaded file has enough file size.
2017-10-26 22:48:35 +09:00
Eugen Rochko 5f137e7ec3 Increase attachment descriptions to 420 characters ()
Blaze it
2017-09-29 02:30:00 +02:00
Eugen Rochko 795e624d5d Add ability to specify alternative text for media attachments ()
* Fix  - Add ability to specify alternative text for media attachments

- POST /api/v1/media accepts `description` straight away
- PUT /api/v1/media/:id to update `description` (only for unattached ones)
- Serialized as `name` of Document object in ActivityPub
- Uploads form adjusted for better performance and description input

* Add tests

* Change undo button blend mode to difference
2017-09-28 15:31:31 +02:00
Francis Chong 395608442d Add media dimensions ()
* Fixes 

- add migration AddMediaAttachmentMeta, which add meta field to media_attachments
- before saving attachment, set file meta if needed
- add meta in api

* add spec

* align the “size” format for image and video

* fix code climate

* fixes media_attachment_spec.rb
2017-04-26 03:48:12 +02:00
Eugen 5849eac93e Fix - Fix gif uploads ()
* Fix  - Fix gif uploads
Add specs for media attachment gifv conversion

* Add ffmpeg to travis

* Make travis install ffmpeg, not libav

* Switch travis to trusty
2017-04-19 23:21:00 +02:00
Eugen Rochko 3cc47beb6e Refactored generation of unique tags, URIs and object URLs into own classes,
as well as formatting of content
2016-09-09 20:04:34 +02:00
Eugen Rochko ae1fac0062 Add API to upload media attachments 2016-09-05 17:46:36 +02:00