Hybris prettyURL 显示 PK 而不是真实文件名
Hybris prettyURL showing PK instead of the real file name
任何图像的文件名都显示为
/de-de/medias/sys_master/images/images/h9c/h5f/8796178743326/8796178743326.jpg
在 url 中。
而不是 8796178743326.jpg
应该有 file-name.jpg
我已经设置 media.legacy.prettyURL=true
8796178743326是图片的PK。
任何帮助!
使用 prettyURL,如果媒体实例中没有 realfilename 值,那么 URL 将以 PK 而不是真实文件名结尾。
/medias/sys_master/images/images/h9c/h5f/8796178743326/8796178743326.jpg
如果您真的想要 URL 中的文件名,那么您必须从 backoffice/impex 编辑相应的媒体并将值分配给 realFileName
属性。
查看 assembleLegacyURL 方法 LocalMediaWebURLStrategy class
String realFileName = this.getRealFileNameForMedia(mediaSource);
if (realFileName == null) {
basePath = mediaSource.getLocation().substring(0, lastDotIdx);
lastDotIndexForRealFileName = StringUtils.lastIndexOf(basePath, '/');
String fileName = basePath.substring(lastDotIndexForRealFileName + 1);
sb.append(basePath).append("/").append(fileName).append('.').append(fileExtension);
} else {
basePath = location.substring(0, lastDotIdx);
lastDotIndexForRealFileName = realFileName.lastIndexOf(46);
if (lastDotIndexForRealFileName != -1) {
realFileName = realFileName.substring(0, lastDotIndexForRealFileName);
}
sb.append(basePath).append("/").append(realFileName).append('.').append(fileExtension);
}
任何图像的文件名都显示为
/de-de/medias/sys_master/images/images/h9c/h5f/8796178743326/8796178743326.jpg
在 url 中。
而不是 8796178743326.jpg
应该有 file-name.jpg
我已经设置 media.legacy.prettyURL=true
8796178743326是图片的PK。
任何帮助!
使用 prettyURL,如果媒体实例中没有 realfilename 值,那么 URL 将以 PK 而不是真实文件名结尾。
/medias/sys_master/images/images/h9c/h5f/8796178743326/8796178743326.jpg
如果您真的想要 URL 中的文件名,那么您必须从 backoffice/impex 编辑相应的媒体并将值分配给 realFileName
属性。
查看 assembleLegacyURL 方法 LocalMediaWebURLStrategy class
String realFileName = this.getRealFileNameForMedia(mediaSource);
if (realFileName == null) {
basePath = mediaSource.getLocation().substring(0, lastDotIdx);
lastDotIndexForRealFileName = StringUtils.lastIndexOf(basePath, '/');
String fileName = basePath.substring(lastDotIndexForRealFileName + 1);
sb.append(basePath).append("/").append(fileName).append('.').append(fileExtension);
} else {
basePath = location.substring(0, lastDotIdx);
lastDotIndexForRealFileName = realFileName.lastIndexOf(46);
if (lastDotIndexForRealFileName != -1) {
realFileName = realFileName.substring(0, lastDotIndexForRealFileName);
}
sb.append(basePath).append("/").append(realFileName).append('.').append(fileExtension);
}