halo-sigs / plugin-migrate

支持多种平台的数据迁移插件
https://halo.run/store/apps/app-TlUBt
GNU General Public License v3.0
8 stars 5 forks source link

迁移到 s3 的图片会抛出 Cannot obtain object key 异常 #24

Closed guqing closed 1 year ago

guqing commented 1 year ago

异常信息:

java.lang.IllegalArgumentException: Cannot obtain object key from attachment attachment-syikU
        at run.halo.s3os.S3OsAttachmentHandler.getPermalink(S3OsAttachmentHandler.java:147) ~[na:na]
        at run.halo.app.core.extension.service.impl.DefaultAttachmentService.lambda$getPermalink$11(DefaultAttachmentService.java:107) ~[classes/:2.8.0]
        at reactor.core.publisher.FluxConcatMapNoPrefetch$FluxConcatMapNoPrefetchSubscriber.onNext(FluxConcatMapNoPrefetch.java:183) ~[reactor-core-3.5.8.jar:3.5.8]
        at reactor.core.publisher.FluxIterable$IterableSubscription.slowPath(FluxIterable.java:335) ~[reactor-core-3.5.8.jar:3.5.8]
        at reactor.core.publisher.FluxIterable$IterableSubscription.request(FluxIterable.java:294) ~[reactor-core-3.5.8.jar:3.5.8]
Attachment Data Example ```json { "spec": { "displayName": "wallhaven-4dgrym", "groupName": "attachment-group-illustration", "policyName": "policy-aliyun-illustration", "ownerName": "guqing", "mediaType": "image/jpeg", "size": 227739 }, "status": { "permalink": "https://guqing-blog.oss-cn-hangzhou.aliyuncs.com/wallhaven-4dgrym_1590148556987.jpg?x-oss-process=style/common_style" }, "apiVersion": "storage.halo.run/v1alpha1", "kind": "Attachment", "metadata": { "generateName": "attachment-", "finalizers": [ "attachment-manager" ], "name": "attachment-syikU", "annotations": { "storage.halo.run/height": "2500", "storage.halo.run/suffix": "jpg", "storage.halo.run/width": "4000", "storage.halo.run/external-link": "https://guqing-blog.oss-cn-hangzhou.aliyuncs.com/wallhaven-4dgrym_1590148556987.jpg?x-oss-process=style/common_style" }, "version": 2, "creationTimestamp": "2023-02-15T10:17:56.328009475Z" } } ```
JohnNiang commented 1 year ago

建议将旧附件的 fileKey 设置到 Attachment 的 annotations 中,annotation 键为:s3os.plugin.halo.run/object-key

JohnNiang commented 1 year ago

/close

Closing in favor of https://github.com/halo-sigs/plugin-s3/pull/57.

f2c-ci-robot[bot] commented 1 year ago

@JohnNiang: Closing this issue.

In response to [this](https://github.com/halo-sigs/plugin-migrate/issues/24#issuecomment-1663313964): >/close > >Closing in favor of . Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.
LIlGG commented 1 year ago

/reopen

f2c-ci-robot[bot] commented 1 year ago

@LIlGG: Reopened this issue.

In response to [this](https://github.com/halo-sigs/plugin-migrate/issues/24#issuecomment-1663483079): >/reopen Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.
guqing commented 1 year ago

迁移插件需要修改添加上 annotation,因此该 issue 将继续