Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【システム】セッションをDBに保存する場合のファイル関係の不都合 #1661

Closed
seto1 opened this issue Mar 5, 2021 · 1 comment
Assignees
Labels
Bug バグ Review レビュー要

Comments

@seto1
Copy link
Collaborator

seto1 commented Mar 5, 2021

概要

セッションをDBに保存する設定にしている場合に以下の不都合があります。

  • フォームでファイルを選択した場合に送信に失敗する
  • ブログ記事追加時にアイキャッチを設定した状態でプレビューを行うと管理画面からログアウトする

baserCMS version : baserCMS 4.4.5-dev

備考

BcUploadBehavior->saveTmpFiles を使用している箇所で問題が起きます。
バイナリデータをDBに保存しようとして失敗している可能性があります。
database.php の encoding が utf8 だと発生せず、 utf8mb4 だと発生することを確認しました。

@seto1 seto1 changed the title セッションをDBに保存する場合のファイル関係の不都合 【システム】セッションをDBに保存する場合のファイル関係の不都合 Mar 5, 2021
@ryuring ryuring added Bug バグ Review レビュー要 labels Mar 30, 2021
@kaburk
Copy link
Collaborator

kaburk commented Jul 14, 2021

ソースを確認したら、確かに一時ファイル(バイナリ)をセッションに保存していました。

セッションをDBに保存する設定の場合、dataカラムをcakeで用意しているSQLではtext型になっているので、
バイナリ型 (MySQLだと longblob型とかかな)にすれば保存できるようになります。
これだと特に改修なしで対応できますが、何処かにノウハウとして書いておかないとわからなくなりそうですが…。
app/Config/Schema/sessions.sql ファイルにコメント追記とかかな?

それか、コアを修正してセッションに保存時にbase64エンコードして保存、読み出し時にデコードするようにすれば解決できそうですね。

@kaburk kaburk self-assigned this Jul 14, 2021
@gondoh gondoh closed this as completed in e077d67 Jul 28, 2021
gondoh added a commit that referenced this issue Jul 28, 2021
fix #1661【システム】セッションをDBに保存する場合のファイル関係の不都合を解消
ryuring pushed a commit that referenced this issue Apr 17, 2023
* fix #1661 BlogPostsService::unpublish のユニットテスト実装

* ユニットテストを調整

Co-authored-by: Đỗ Văn Hùng <HungDV2022>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug バグ Review レビュー要
Projects
None yet
Development

No branches or pull requests

3 participants