バージョン9.4.0からドキュメントライブラリでファイルをクリックしたときの動作が変わり,ブラウザのダウンロードボタンが強制的に起動されてしまいます.
( リリースノートBehavioral ImprovementsのWe now specify the file download from the Document Library)
これのために従来できていた独自のファイル処理の起動ができなくなってしまいました.
独自のファイル処理とは,具体的にはPDFファイルへのクリックを受けて.htaccessが反応し,カスタマイズしたPDF.jsによってブラウザへの表示を行う,というものです.
ドキュメントライブラリにバージョン9.3.9までと同じ動作をさせるにはどうしたらいいでしょうか?
hissy
June 19, 2025, 7:44am
2
該当の修正内容はこれかなとおもいます
9.4.x ← ounziw:develop
opened 04:25AM - 15 Jan 25 UTC
This is an enhancement proposal.
Files are uploaded and these file names are … converted to ASCII-only strings.
If the file names are originally Japanese, these filenames are often hard to read.
Adding a download attribute for <a> will specify the name for the download-target file. That is, if the download link is clicked, the browser will use the name as the file's default filename.
For the detailed specification, please see https://www.w3schools.com/tags/att_a_download.asp
<a href="FILE_PATH_HERE" download="FILE_NAME_HERE">
もし戻したい場合、オーバーライドでカスタマイズできます。
ご参考まで
Replyを書き直します.
この件ですが, 示していただいた修正の戻しをupdatesディレクトリ以下のcontroller.phpを直接書き換えで行うと,当初の問題は解決します.
ですが,オーバーライドでやろうとするとうまくいきません.ドキュメントライブラリにファイル一覧が表示されずに空の表が表示されたり,
予期せぬエラーが発生しました,となってしまいます.
(何も手を加えていないコードでオーバーライドしても起こります)
オーバーライドはapplication/blocks/document_library/controller.php に対し以下のように記述しました.
<?php
namespace Application\Block\DocumentLibrary;
use Concrete\Block\DocumentLibrary\Controller as DocumentLibraryBlockController;
class Controller extends DocumentLibraryBlockController
{
public function getColumnValue($key, $file)
{
if ($file instanceof \Concrete\Core\Tree\Node\Type\File) {
$file = $file->getTreeNodeFileObject();
} elseif ($file instanceof FileFolder) {
return $this->getFolderColumnValue($key, $file);
} else {
以下略
}
書かれていた通りにやったつもりなのですが, 間違っているでしょうか?
hissy
August 7, 2025, 6:00am
5
そもそも不具合と思われますのでIssue登録しました。
opened 03:33PM - 06 Aug 25 UTC
Type:Bug
### Affected Version of Concrete CMS
9.x
### Description
The “Display in brow… ser (if possible)” option in the Document Library block is currently not functioning as expected.
<img width="1506" height="851" alt="Image" src="https://github.com/user-attachments/assets/24e5efaa-de3a-4127-8c37-6d7c15dd92a6" />
#### Expected behavior
When the “Display in browser” option is selected, clicking a file (e.g., PDF) should open it directly in the browser, if the browser supports it.
#### Actual behavior:
The file is always downloaded instead of being displayed in the browser.
#### Possible cause:
This behavior started after the following pull request was merged, which added a download attribute to file links:
https://github.com/concretecms/concretecms/pull/12415
The presence of the download attribute forces the browser to download the file rather than display it inline, regardless of the “Display in browser” setting.
### How to reproduce
Add a document library block with "Display in browser" option enabled.
Try to click a file name.
### Possible Solution
Avoid setting the download attribute when “Display in browser” is selected, or completely revert #12415
### Additional Context
A user reported this issue in the following forum post:
https://forums.concretecms.org/t/9-4-0/9203