Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Assets field: Discard and use existing file issue

已关闭
#15,556 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

已经有一个关联 PR 被合并了。

  • #15716 来自 @mynetx —— 已合并

评估

难度
3/5
预计耗时
1-2 天
新手友好度
66/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
laravel, php
领域
backend

调研方向

Start at the assets field's upload/update handling and trace what happens when choosing “Discard and use existing file.” Reproduce the issue with an existing file and the reported assets-field setup, then inspect the related tests. Done means the existing file is shown correctly and the entry saves without the reported error.

由索引模型根据 Issue 内容生成。

描述

assets fieldtypes
Bug description

I've noticed this problem on multiple projects recently.

If I have an assets field and try to upload an existing file then a message is displayed as expected:
Image

After choosing 'Discard and use existing file' this happens (note the generic icon and strange path / usually a PDF icon is shown):
Image

Then when clicking 'Save & Publish' this happens:
Image

How to reproduce
  1. Set up an assets field
  2. Update a file that already exists.
  3. Choose discard and use existing file
  4. Save the entry.
Logs

Environment
Environment
Laravel Version: 13.33.0
PHP Version: 8.4.24
Composer Version: 2.10.2
Environment: local
Debug Mode: ENABLED
Maintenance Mode: OFF
Timezone: Europe/Dublin
Locale: en_IE

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: log
Cache: file
Database: mysql
Logs: stack / single
Mail: smtp
Queue: database
Session: file

Storage
J:\webdev\herd\mywebsite\public\storage: NOT LINKED

Livewire
Livewire: v4.4.6

Statamic
Addons: 4
License Key: Not set
Sites: 2 (mywebsite.ie, mywebsite.co.uk)
Stache Watcher: Enabled (auto)
Static Caching: Disabled
Version: 6.34.1 PRO

Statamic Addons
alt-design/alt-cookies: 1.3.1-alpha
marcorieser/statamic-livewire: 5.3.4
spatie/statamic-responsive-images: 6.2.0
stuartcusackie/statamic-cache-requester: 1.3.2
Installation

Existing Laravel app

Additional details

Based on the error message, my best guess is that the root of the filesystem is not being handled correctly by the assets field, i.e. 'root' => 'public_downloads'

主要语言
PHP
星标
4.9k
派生
647
平均合并
1 天 14 小时
30 天内合并 PR
148

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

statamic/cms 的其他 Issue

查看 statamic/cms 的全部 Issue

相似的 Issue

更多 PHP Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。