apache / apache/answer

Accessing Uploaded Attachments and Images Return HTTP 302 with Location /403

Offen
#1,328 4 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
bug
Vorherrschende Sprache
Go
Sterne
15.7k
Forks
1.4k
Ø Merge
3 T. 8 Std.
Gemergte PRs (30 T.)
7

Beschreibung

## Describe the bug

Add images and attachment to a post successfully, no error shows up, and then reopen the post, but image isn't displayed and attachement can't be downloaded.

I inspect the network activities. Refreshing the post with the image sends HTTP GET, but receives HTTP 302 response with location /403.

Clicking the attachment sends the HTTP GET, but receives HTTP 302 response with location /403.

### To Reproduce

Steps to reproduce the behavior:

1. Unpack binary distribution from github, to directory ~/apache-answer-1.4.5-bin-linux-amd64, where there is the executable.
2. Follow the guide on the official site.
3. Run the command and set up database, email and admin.

`ubuntu@VM-0-8-ubuntu:~/apache-answer-1.4.5-bin-linux-amd64$ sudo ./answer init -C ./answer-data/`

4. Run the command to bring up the forum.

`ubuntu@VM-0-8-ubuntu:~/apache-answer-1.4.5-bin-linux-amd64$ sudo nohup ./answer run -C ./answer-data/`

5. Login, create a new question, post an image or upload an attachment.
6. Go back to landing page and reopen the previous post to examine the image and attachement, can't be shown or downloaded.
7. Inspect the network activities with dev tool and locate the URL:

`http://plusai.site/uploads/files/post/5smfTQVm1EU/test.pdf`
`http://plusai.site/uploads/post/5smt4sbUZA9.png`

8. On server, navigate to the data directory, which is

`~/apache-answer-1.4.5-bin-linux-amd64/answer-data`

The path to previous uploaded files are

`~/apache-answer-1.4.5-bin-linux-amd64/answer-data/uploads/files/post/5smfTQVm1EU.pdf`
`~/apache-answer-1.4.5-bin-linux-amd64/answer-data/uploads/post/5smt4sbUZA9.png`

9. confi.yaml after initialization is like
`
ui:
base_url: ""
api_base_url: ""
`

There is **_no public_url arttribute_**.

### Expected behavior

Image is displayed, and attachment can be downloaded by clicking the link.

### Screenshots

No screenshot.

### Platform

- Device: Server
- OS: Ubuntu 2024.5
- Browser and version: Edge Lastest
- Version: 1.4.5

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

Reproduziere das Problem mit der 1.4.5-Binärdatei, indem du `answer init -C ./answer-data/` und `answer run -C ./answer-data/` ausführst. Untersuche anschließend die Upload-URLs, Weiterleitungen, `confi.yaml` und die Dateien unter `answer-data/uploads/`. Verfolge nach, warum Bild- und Anhangsanfragen zu `/403` weitergeleitet werden; abgeschlossen ist die Aufgabe, wenn Bilder angezeigt werden und Anhänge erfolgreich heruntergeladen werden können.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
go
Bereich
backend
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
42/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.