V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
w985341237
V2EX  ›  程序员

请教 springboot 对接 Azure 上传文件问题

  •  
  •   w985341237 · 21 天前 · 709 次点击

    我有个对接 Azure 的问题想请教一下。我在 maven 里引了 azure-storage-blob ,也拿到了 sasToken ,构建 blobClient 调用 isExists 和 downloadToFile 都没问题。 但是调用 upload 上传文件就一直报错,错误是

    Caused by: com.azure.storage.blob.models.BlobStorageException: Status code 400, "<Error>InvalidHeaderValue<Message>The value for one of the HTTP headers is not in the correct format. RequestId:89202da3-801a-000d-5cce-b3b7f3000000 Time:2024-06-01T02:48:29.2368676Z</Message><HeaderName>Content-Length</HeaderName><HeaderValue>24</HeaderValue></Error>"

    很奇怪,但是我如果不用 sdk ,直接用 Azcopy 是可以上传成功的。不知道各位有没有遇见过类似问题

    2 条回复    2024-06-01 19:27:52 +08:00
    SculptureSand
        2
    SculptureSand  
       21 天前
    后端调用 SDK 签发 Azure 对象存储 URL ,前端(特指浏览器)PUT 上传?
    可能是 Content-Type 的问题,前端会自动指定,后端要主动填一下
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2142 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 01:58 · PVG 09:58 · LAX 18:58 · JFK 21:58
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.