替换Sitecore媒体库链接中的空格

时间:2012-10-05 15:45:15

标签: c# .net sitecore sitecore6

当W3C验证我的页面时,我收到了这些错误:

Bad value /~/media/Image Libraries/Carousel Images/sea.jpg?w=652&h=263&bc=transparent&as=1&thn=1 for attribute src on element img: Whitespace in path component. Use %20 in place of spaces.

管道中是否存在某些地方或者我们在渲染之前更改这些链接?

修改

这是一个示例图片标记:

<img width="257" height="155" src="/~/media/Image Libraries/Section Pods/headphonewoman.jpg?w=257&h=155&bc=transparent&as=1&thn=1" alt="Administration">

这是确切的错误:

Error Line 565, Column 218: Bad value /~/media/Image Libraries/Carousel Images/office.jpg?w=652&h=263&bc=transparent&as=1&thn=1 for attribute src on element img: Whitespace in path component. Use %20 in place of spaces.

…ages/office.jpg?w=652&amp;h=263&amp;bc=transparent&amp;as=1&amp;thn=1" />

Syntax of IRI reference:
    Any URL. For example: /hello, #canvas, or http://example.org/. Characters should be represented in NFC and spaces should be escaped as %20. 

我们还尝试添加一个覆盖GetMediaUrlSitecore.Resources.Media.MediaProvider的管道,但这没有帮助。

1 个答案:

答案 0 :(得分:3)

您可以潜在<encodeNameReplacements>的{​​{1}}节点下执行此操作

web.config