3

当 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. 

我们还尝试添加一个覆盖其中的管道,GetMediaUrl但这Sitecore.Resources.Media.MediaProvider无济于事。

4

1 回答 1

3

您可以以下<encodeNameReplacements>节点下执行此操作web.config

<encodeNameReplacements>
  // ..
  <replace mode="on" find=" " replaceWith="%20" />
  // ..
</encodeNameReplacements>
于 2012-10-05T17:31:20.837 回答