Bug: Error deleting an attachment
Reproduced for both 'mysql' and 'postgres'.
Steps to reproduce the behavior
- Use a 'Meeting Agenda' template board
- Create a new Task, name it
- Attach a file (a picture in my case).
- Try deleting picture immediately (or close and open task and try deleting it).
- The error on the server is:
MYSQL:
Nov 27 08:14:05 debian-s-1vcpu-1gb-nyc3-01 focalboard-server[26049]: error [2023-11-27 08:14:05.962 Z] API ERROR caller="api/api.go:200" code=500 error="Error 1146 (42S02): Table 'boards.FileInfo' doesn't exist" api=/api/v2/boards/bhzb1f43dibrh7n3yyf37foumzw/blocks/ijwq4xxh4ajni7m56twothzw4yw
POSTGRES:
Nov 27 08:03:59 debian-s-1vcpu-1gb-nyc3-01 focalboard-server[25505]: error [2023-11-27 08:03:59.086 Z] API ERROR caller="api/api.go:200" code=500 error="pq: relation "fileinfo" does not exist" api=/api/v2/boards/bkqgipcf35j8emfy5ntjiog9rpe/blocks/ipc3rzfgqqjfj7qjyt6crsi415c
Expected behavior
An attachment should be deleted with no issues.
Edition and Platform
- Edition: Personal Server
- Version: v7.11.3
- Browser and OS: Firefox, Safari on Mac.
Additional context (optional)
- Server is working on Debian. Add any other context about the problem here, and any notes about the severity:
- Sev 1: Affects critical functionality without a workaround
- Sev 2: Affects major functionality with a difficult or non-obvious workaround
- Sev 3: Affects minor, non-critical functionality
database table name and column name differ when create and delete. file_info vs. FifeInfo delete_at vs. DeleteAt
-
In file: focalboard/server/services/store/sqlstore/file.go 16 query := s.getQueryBuilder(db). 17 Insert(s.tablePrefix+"file_info"). 18 Columns( 19 "id", 20 "create_at", 21 "name", 22 "extension", 23 "size", 24 "delete_at", 25 "path", 26 "archived", 27 ).
-
In file: focalboard/server/services/store/sqlstore/blocks.go 436 deleteFileInfoQuery := s.getQueryBuilder(db). 437 Update("FileInfo"). 438 Set("DeleteAt", model.GetMillis()). 439 Where(sq.Eq{"id": fileID}) 440 if _, err := deleteFileInfoQuery.Exec(); err != nil { 441 return err 442 } 443 }
https://github.com/stypr/focalboard/commits/682398f75396ec2efeee731a43f511b3143933d0/server/services/store/sqlstore/blocks.go
This fixes the bug but you probably have to write an additional code to actually delete the attachment