Skip to content

xls无法正常的预览 #108

@xmlgrg

Description

@xmlgrg

redmine版本:5.0.11
服务器系统:TencentOS-Server-3.3-20241220.2-TK4-x86_64
使用的是nginx跳转

报错信息如下:
App 3507 output: [2aefb108-ecca-4d21-8a38-69824fa7f33c] Processing by AttachmentsController#show as HTML
App 3507 output: [2aefb108-ecca-4d21-8a38-69824fa7f33c] Parameters: {"id"=>"4", "filename"=>"QR-YW-002-B 机房巡检记录表.xls"}
App 3507 output: [2aefb108-ecca-4d21-8a38-69824fa7f33c] Current user: admin (id=1)
App 3507 output: [2aefb108-ecca-4d21-8a38-69824fa7f33c] Rendered plugins/redmine_more_previews/app/views/attachments/more_preview.html.erb within layouts/base (Duration: 68.6ms | Allocations: 12221)
App 3507 output: [2aefb108-ecca-4d21-8a38-69824fa7f33c] Rendered layout layouts/base.html.erb (Duration: 108.9ms | Allocations: 32687)
App 3507 output: [2aefb108-ecca-4d21-8a38-69824fa7f33c] Completed 200 OK in 128ms (Views: 100.7ms | ActiveRecord: 13.5ms | Allocations: 36841)
App 3507 output: [de675df1-e2b8-48cf-8912-b39a274d1fb1] Started GET "/attachments/more_preview/4/index.html" for 172.16.2.76 at 2025-03-04 11:31:13 +0800
App 3507 output: [de675df1-e2b8-48cf-8912-b39a274d1fb1] Processing by AttachmentsController#more_preview as HTML
App 3507 output: [de675df1-e2b8-48cf-8912-b39a274d1fb1] Parameters: {"id"=>"4"}
App 3507 output: [de675df1-e2b8-48cf-8912-b39a274d1fb1] Current user: admin (id=1)
App 3507 output: Error: source file could not be loaded
App 3507 output: mv: 无法获取'./250304100044_ea5434bb2e162dd35b74c0bd354a2c44.html' 的文件状态(stat)
App 3507 output: : 没有那个文件或目录
App 3507 output: [de675df1-e2b8-48cf-8912-b39a274d1fb1] Creating preview with Libre failed (pid 3623 exit 1):
App 3507 output: Command: cd '/tmp/d20250304-3507-75vkrn'; soffice --headless --convert-to html --outdir '/tmp/d20250304-3507-75vkrn' -env:UserInstallation=file:///tmp/d20250304-3507-8ko1ps/user_installation '/var/www/redmine/files/2025/03/250304100044_ea5434bb2e162dd35b74c0bd354a2c44.xls'; mv './250304100044_ea5434bb2e162dd35b74c0bd354a2c44.html' '/tmp/d20250304-3507-75vkrn/index.html'
App 3507 output: [de675df1-e2b8-48cf-8912-b39a274d1fb1] An error occured while generating preview for /var/www/redmine/files/2025/03/250304100044_ea5434bb2e162dd35b74c0bd354a2c44.xls
App 3507 output: [de675df1-e2b8-48cf-8912-b39a274d1fb1] Exception was: RedmineMorePreviews::Exceptions::ConverterShellError

可能的原因: 没有在tmp下创建临时文件夹 /tmp/d20250304-3507-75vkrn 和 /tmp/d20250304-3507-8ko1ps
如果手动 创建了文件夹/tmp/d20250304-3507-75vkrn 后 ,在手动执行 cd '/tmp/d20250304-3507-75vkrn'; soffice --headless --convert-to html --outdir '/tmp/d20250304-3507-75vkrn' -env:UserInstallation=file:///tmp/d20250304-3507-8ko1ps/user_installation '/var/www/redmine/files/2025/03/250304100044_ea5434bb2e162dd35b74c0bd354a2c44.xls'; mv './250304100044_ea5434bb2e162dd35b74c0bd354a2c44.html' '/tmp/d20250304-3507-75vkrn/index.html' 是可以看到 转换后的 文件的

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions