fix(files): only use service rootpath for files when the files path is not absolute
Resolves https://community.vikunja.io/t/images-failing-to-load-500-internal-server-error/2835 (cherry picked from commit 261c6e6c9e5ad8484cd4b5cee7174de1a3a4156e)
This commit is contained in:
parent
99bed5c616
commit
f32472eb24
@ -22,6 +22,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"code.vikunja.io/api/pkg/config"
|
"code.vikunja.io/api/pkg/config"
|
||||||
@ -58,8 +59,12 @@ func (*File) TableName() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (f *File) getAbsoluteFilePath() string {
|
func (f *File) getAbsoluteFilePath() string {
|
||||||
|
base := ""
|
||||||
|
if !strings.HasPrefix(config.FilesBasePath.GetString(), "/") {
|
||||||
|
base = config.ServiceRootpath.GetString()
|
||||||
|
}
|
||||||
return filepath.Join(
|
return filepath.Join(
|
||||||
config.ServiceRootpath.GetString(),
|
base,
|
||||||
config.FilesBasePath.GetString(),
|
config.FilesBasePath.GetString(),
|
||||||
strconv.FormatInt(f.ID, 10),
|
strconv.FormatInt(f.ID, 10),
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user