MCPcopy Index your code
hub / github.com/TruthHun/DocHub / ImageWithDomain

Method ImageWithDomain

models/CloudStoreModel.go:295–312  ·  view source on GitHub ↗
(htmlOld string)

Source from the content-addressed store, hash-verified

293}
294
295func (c *CloudStore) ImageWithDomain(htmlOld string) (htmlNew string) {
296 doc, err := goquery.NewDocumentFromReader(strings.NewReader(htmlOld))
297 if err != nil {
298 helper.Logger.Error(err.Error())
299 return htmlOld
300 }
301 doc.Find("img").Each(func(i int, s *goquery.Selection) {
302 // For each item found, get the band and title
303 if src, exist := s.Attr("src"); exist {
304 if !(strings.HasPrefix(src, "http://") || strings.HasPrefix(src, "https://")) {
305 s.SetAttr("src", c.GetSignURL(src))
306 }
307 }
308
309 })
310 htmlNew, _ = doc.Find("body").Html()
311 return
312}
313
314func (c *CloudStore) ImageWithoutDomain(htmlOld string) (htmlNew string) {
315 doc, err := goquery.NewDocumentFromReader(strings.NewReader(htmlOld))

Callers 2

PagesMethod · 0.95
EditMethod · 0.80

Calls 1

GetSignURLMethod · 0.95

Tested by

no test coverage detected