Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow migrating attachments from other places #2807

Merged
merged 2 commits into from
Nov 30, 2022

Conversation

JohnNiang
Copy link
Member

What type of PR is this?

/kind improvement
/area core
/milestone 2.0.0

What this PR does / why we need it:

This PR provides an ability to migrate attachments from other places, like Halo 1.x or Wordpress.

We could simply configure resource mappings to support attachments migration:

halo:
  attachment:
    resource-mappings:
      - pathPattern: /upload/**
        locations:
          - upload
          - migrate-from-1.x
      - pathPattern: /wp-content/uploads/**
        locations:
          - migrate-from-wp

Meanwhile, I refactored LocalAttachmentUploadHandler for managing attachments from migration in the future.

Which issue(s) this PR fixes:

Fixes #2585

Special notes for your reviewer:

Steps to test:

  1. Try to configure the resource mappings
  2. Put some static resources into the corresponding location
  3. Access it from Browser

At last, please make sure the functionalities of attachment are ok as before.

Does this PR introduce a user-facing change?

None

@f2c-ci-robot f2c-ci-robot bot added release-note-none Denotes a PR that doesn't merit a release note. kind/improvement Categorizes issue or PR as related to a improvement. labels Nov 30, 2022
@f2c-ci-robot f2c-ci-robot bot added this to the 2.0.0 milestone Nov 30, 2022
@f2c-ci-robot f2c-ci-robot bot added the area/core Issues or PRs related to the Halo Core label Nov 30, 2022
Copy link
Member

@guqing guqing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/approve

我配置

halo:
  attachment:
    resource-mappings:
      - pathPattern: /route-prefix/**
        locations:
          - test

然后在 {halo-work-dir}/attachments/test/ 放入一张 me.jpeg
最终访问 http://localhost:8090/route-prefix/me.jpeg 成功,访问没有的图片 404 符合期望

@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Nov 30, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: guqing

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@f2c-ci-robot f2c-ci-robot bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 30, 2022
Signed-off-by: John Niang <johnniang@fastmail.com>
Copy link
Member

@ruibaby ruibaby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

image

@f2c-ci-robot f2c-ci-robot bot added the lgtm Indicates that a PR is ready to be merged. label Nov 30, 2022
@f2c-ci-robot f2c-ci-robot bot merged commit 540cafc into halo-dev:main Nov 30, 2022
@JohnNiang JohnNiang deleted the feat/attachment-migration branch December 13, 2022 08:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/core Issues or PRs related to the Halo Core kind/improvement Categorizes issue or PR as related to a improvement. lgtm Indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

提供 1.x 迁移到 2.0 的工具和方案
3 participants