Automatic Merge
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
2fceeceba6
Коммит
f21005e359
@@ -34,6 +34,7 @@ type linkMetadataCache struct {
|
||||
OpenGraph *opengraph.OpenGraph
|
||||
PostImage *model.PostImage
|
||||
Permalink *model.Permalink
|
||||
URL string
|
||||
}
|
||||
|
||||
const MaxMetadataImageSize = MaxOpenGraphResponseSize
|
||||
@@ -812,6 +813,11 @@ func getLinkMetadataFromCache(requestURL string, timestamp int64) (*opengraph.Op
|
||||
return nil, nil, nil, false
|
||||
}
|
||||
|
||||
// Verify that the cached entry matches the requested URL
|
||||
if cached.URL != requestURL {
|
||||
return nil, nil, nil, false
|
||||
}
|
||||
|
||||
return cached.OpenGraph, cached.PostImage, cached.Permalink, true
|
||||
}
|
||||
|
||||
@@ -860,6 +866,7 @@ func cacheLinkMetadata(rctx request.CTX, requestURL string, timestamp int64, og
|
||||
OpenGraph: og,
|
||||
PostImage: image,
|
||||
Permalink: permalink,
|
||||
URL: requestURL,
|
||||
}
|
||||
|
||||
if err := platform.LinkCache().SetWithExpiry(strconv.FormatInt(model.GenerateLinkMetadataHash(requestURL, timestamp), 16), metadata, platform.LinkCacheDuration); err != nil {
|
||||
|
||||
Ссылка в новой задаче
Block a user