Misskey: UserProfile.descriptionは外部ユーザーの場合1024文字だと足りないことがある

Created on 26 Apr 2019  ·  8Comments  ·  Source: syuilo/misskey

💡 Summary

英語とかだとCJKの数倍に膨らむこともあるので仕方なくはある

  • 1024文字までで切り詰め (どうせ完全なものではないので切ってもいいという考え方)
  • textにする (完全でないとは言え途中で切るのはちょっと…派)

どっちがいいと思いますか?

Raw log from #4808

USER (29/8654) 5c6a4fa5534d984873bee848 ERR
{ QueryFailedError: value too long for type character varying(1024)
    at new QueryFailedError (/home/misskey/misskey_new/node_modules/typeorm/error/QueryFailedError.js:11:28)
    at Query.callback (/home/misskey/misskey_new/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:174:38)
    at Query.handleError (/home/misskey/misskey_new/node_modules/pg/lib/query.js:142:17)
    at Connection.connectedErrorMessageHandler (/home/misskey/misskey_new/node_modules/pg/lib/client.js:183:17)
    at Connection.emit (events.js:197:13)
    at Socket.<anonymous> (/home/misskey/misskey_new/node_modules/pg/lib/connection.js:125:12)
    at Socket.emit (events.js:197:13)
    at addChunk (_stream_readable.js:288:12)
    at readableAddChunk (_stream_readable.js:269:11)
    at Socket.Readable.push (_stream_readable.js:224:10)
  message: 'value too long for type character varying(1024)',
  name: 'QueryFailedError',
  length: 100,
  severity: 'ERROR',
  code: '22001',
  detail: undefined,
  hint: undefined,
  position: undefined,
  internalPosition: undefined,
  internalQuery: undefined,
  where: undefined,
  schema: undefined,
  table: undefined,
  column: undefined,
  dataType: undefined,
  constraint: undefined,
  file: 'varchar.c',
  line: '624',
  routine: 'varchar',
  query:
   'INSERT INTO "user_profile"("userId", "location", "birthday", "description", "fields", "url", "email", "emailVerifyCode", "emailVerified", "twoFactorTempSecret", "twoFactorSecret", "twoFactorEnabled", "password", "clientData", "autoWatch", "autoAcceptFollowed", "alwaysMarkNsfw", "carefulBot", "twitter", "twitterAccessToken", "twitterAccessTokenSecret", "twitterUserId", "twitterScreenName", "github", "githubAccessToken", "githubId", "githubLogin", "discord", "discordAccessToken", "discordRefreshToken", "discordExpiresDate", "discordId", "discordUsername", "discordDiscriminator", "userHost") VALUES ($1, $2, $3, $4, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, $5, $6, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, $7) RETURNING "fields", "emailVerified", "twoFactorEnabled", "clientData", "autoWatch", "autoAcceptFollowed", "alwaysMarkNsfw", "carefulBot", "twitter", "twitterAccessToken", "twitterAccessTokenSecret", "twitterUserId", "twitterScreenName", "github", "githubAccessToken", "githubId", "githubLogin", "discord", "discordAccessToken", "discordRefreshToken", "discordExpiresDate", "discordId", "discordUsername", "discordDiscriminator"',
  parameters:
   [ '5c6a4fa5534d984873bee848',
     null,
     null,
     `It is kind of a jerk maneuver for you to have actively participated in making FSE notorious for this behavior and to have and celebrated getting us blocked after annoying instances with excessive edgeposting, and then to complain about exactly the thing you spent all that time doing.\n\n> Do your damnedest to get us blocked by as many instances as possible\n> Delete and recreate account repeatedly and then WBR-post at people that blocked your previous account\n> Tell people to kill themselves\n> Loudly proclaim that you want everyone to block FSE so it can just be you and folk\n> Be one of the people that *caused* kaniini to write FSEPolicy\n> Hop instances, say you're going to be super chill at the new instance, no causing trouble now\n> "I'm actually kinda glad we have FSEPolicy"\n\nYou shat in my yard, and now you are telling me my yard smells like shit and you're glad you moved somewhere that doesn't smell like shit.\n\n"I've seen it a thousand times." I believe that, because you did it a thousand times.\n\nI ain't even mad bro, but I think it's a little disappointing that you don't see the irony that you were happy to dish it out, and you perhaps haven't noticed that you are adding insult to injury. Not tryna make you (or anyone) feel down, but it would be cool if you didn't complain until you pick up a shovel yourself.`,
     false,
     true,
     'freespeechextremist.com' ] }

⚙️Server 🌌Federation 💬Discussion

All 8 comments

2048 とか 4096 くらいにするのはどうですか?

1024を2048 or 4096 にするにしろ長さ無限でいれられるActivityPub実装があるとどうしようもないので、ある程度で切るかそれともtextで無限にするかというのを決めたい (無限にするとあまりよくなさそうだけど投稿テキストでもう無限になってるという話はある)
私は2048ぐらいなら切ってもいい気はする

ある程度で切るようにしたいとは思います

投稿テキストを text にしたのは失敗だったと思ってて、そのうち変えそう

その時、切るのはどれくらいがいいですかね?

  • 1024 (現状)
  • 2048 (by @syuilo )
  • 4096 (by @syuilo )
  • もしくはもっと…?

あと、truncatedフラグがあるとよさそう (途中で切られたことを明示したほうが親切っぽい)

とりあえず 2048 で様子見で良さそう
フラグを新たに作るのは面倒なので省略した場合末尾に ... を付けるようにすれば良さそう

それだと普通に…で終わった場合と区別が付かなさそう

Show moreとか表示作って元鯖にリンクってのはどうでしょう

Was this page helpful?
0 / 5 - 0 ratings