我正在使用 AEM 6.3。我正在使用 Assets API 通过curl命令上传资产。我就是这样做的:
curl -i 'http://localhost:4502/api/assets/newFolder' -H "Content-Type: application/json" -d '{"class":"assetFolder","properties":{"title":"New folder"}}' -u admin:admin
如果它们不存在,我的用例需要创建中间目录。是这样的:
curl -i 'http://localhost:4502/api/assets/intermediate1/intermediate2/newFolder' -H "Content-Type: application/json" -d '{"class":"assetFolder","properties":{"title":"New folder"}}' -u admin:admin
在上面的示例中,中间件 1 和中间件 2 都不存在。卷曲不起作用,AEM 返回:
HTTP/1.1 500 Server Error
Date: Wed, 21 Aug 2019 14:13:35 GMT
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
Set-Cookie: cq-authoring-mode=CLASSIC;Path=/;Expires=Wed, 28-Aug-2019 14:13:35 GMT
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Content-Type: application/json; charset=UTF-8
Transfer-Encoding: chunked
{"class":["core/response"],"properties":{"path":"/api/assets/intermediate1/intermediate2/newFolder","parentLocation":"/api/assets/intermediate1/intermediate2.json","referer":"","changes":[],"location":"/api/assets/intermediate1/intermediate2/newFolder.json","status.code":500}}
500错误很奇怪。从日志中我可以看到:
21.08.2019 11:13:35.512 *ERROR* [0:0:0:0:0:0:0:1 [1566396815508] POST /api/assets/intermediate1/intermediate2/newFolder HTTP/1.1] com.adobe.granite.rest.impl.servlet.PostRequest Exception during request processing.
java.lang.NullPointerException: null
at com.adobe.granite.rest.assets.impl.AssetResourceProvider.getDataPropertyKey(AssetResourceProvider.java:412)
也许 AEM Assets API 不支持创建不存在的中间文件夹?也许 500 错误只是一个错误?
至尊宝的传说
相关分类