mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-08-01 22:02:46 +00:00
Media filename handling improvements (#1140)
* Derive content ID from hash+filename but preserve dedupe, improve Content-Disposition handling and ASCII handling * Linter fix * Some more comments * Update sytest-whitelist
This commit is contained in:
parent
a66a3b830c
commit
5d5aa0a31d
4 changed files with 80 additions and 13 deletions
|
@ -16,6 +16,7 @@ package routing
|
|||
|
||||
import (
|
||||
"context"
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
|
@ -123,7 +124,9 @@ func (r *uploadRequest) doUpload(
|
|||
|
||||
r.MediaMetadata.FileSizeBytes = bytesWritten
|
||||
r.MediaMetadata.Base64Hash = hash
|
||||
r.MediaMetadata.MediaID = types.MediaID(hash)
|
||||
r.MediaMetadata.MediaID = types.MediaID(base64.RawURLEncoding.EncodeToString(
|
||||
[]byte(string(r.MediaMetadata.UploadName) + string(r.MediaMetadata.Base64Hash)),
|
||||
))
|
||||
|
||||
r.Logger = r.Logger.WithField("MediaID", r.MediaMetadata.MediaID)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue