Johann150 414f1d1158
fix: truncate image descriptions (#7699)
* move truncate function to separate file to reuse it

* truncate image descriptions

* show image description limit in UI

* correctly treat null

Co-authored-by: nullobsi <me@nullob.si>

* make truncate Unicode-aware

The strings that truncate returns should now be valid Unicode.

PostgreSQL also counts Unicode Code Points instead of bytes so this
should be correct.

* move truncate to internal, validate in API

Truncating could also be done in src/services/drive/add-file.ts or
src/services/drive/upload-from-url.ts but those would also affect
local images. But local images should result in a hard error if the
image comment is too long.

* avoid overwriting

Co-authored-by: nullobsi <me@nullob.si>
2021-09-30 01:44:22 +09:00
..
2020-04-26 11:54:51 +09:00
2021-07-15 20:45:32 +09:00
2019-03-21 04:50:44 +09:00
2021-05-30 20:52:39 +09:00
2021-04-11 00:18:29 +09:00
2021-04-11 00:18:29 +09:00
2021-08-19 18:33:41 +09:00
2020-05-10 18:42:31 +09:00
2020-10-17 20:12:00 +09:00
2020-12-28 23:41:09 +09:00
2021-02-13 12:28:26 +09:00
2019-04-13 01:43:22 +09:00
2021-08-19 18:33:41 +09:00
2021-02-07 10:43:34 +09:00
2020-06-21 14:07:27 +09:00
2020-02-20 13:33:41 +09:00