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

Amazon S3 Media Storage support #11738

Merged
merged 29 commits into from
May 30, 2022
Merged

Amazon S3 Media Storage support #11738

merged 29 commits into from
May 30, 2022

Conversation

neglectedvalue
Copy link
Contributor

Hi, long time ago I've created module to support AWS S3 bucket for Orchard media storage and since OrchardCore was in my opinion Azure based I did not think about any contributions, but recently @Piedone contacted with me and suggested to create a PR.
Basically nothing complex, module for Azure Media support was done nicely and understandable so I've made mine as much equal as possible.

@dnfadmin
Copy link

dnfadmin commented May 21, 2022

CLA assistant check
All CLA requirements met.

@hishamco
Copy link
Member

I was planned to make this for Orchard Core Contrib (OCC), but it's good to see someone push a PR to implement it

Copy link
Member

@Piedone Piedone left a comment

Choose a reason for hiding this comment

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

Awesome, thank you!

src/OrchardCore.Cms.Web/appsettings.json Outdated Show resolved Hide resolved
src/OrchardCore.Cms.Web/appsettings.json Outdated Show resolved Hide resolved
src/OrchardCore.Cms.Web/appsettings.json Outdated Show resolved Hide resolved
@Piedone
Copy link
Member

Piedone commented May 24, 2022

Please ask for a review (upper right corner) if you're done addressing all the feedback.

@neglectedvalue
Copy link
Contributor Author

Yes, sorry always forgetting about it.

@neglectedvalue
Copy link
Contributor Author

I've looked at Azure Media module and I want to transfer some things into Amazon Media : templating for BucketName/ BasePath and ModularEvent so it would be possible to create S3 bucket automatically. Hope I'll finish it today.

src/OrchardCore.Cms.Web/appsettings.json Outdated Show resolved Hide resolved
src/docs/reference/README.md Outdated Show resolved Hide resolved
src/docs/reference/modules/Media.Azure/README.md Outdated Show resolved Hide resolved
src/docs/reference/modules/Media.Amazon/README.md Outdated Show resolved Hide resolved
src/docs/reference/modules/Media.Amazon/README.md Outdated Show resolved Hide resolved
src/docs/reference/modules/Media.Amazon/README.md Outdated Show resolved Hide resolved
Copy link
Member

@Piedone Piedone left a comment

Choose a reason for hiding this comment

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

Apart from these and #11738 (comment) looks good.

@Piedone
Copy link
Member

Piedone commented May 25, 2022

Oh, and also address #11738 (comment), please.

Copy link
Member

@Piedone Piedone left a comment

Choose a reason for hiding this comment

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

Anything you'd like to add, @hishamco @jtkech?


options.BucketName = template
.Render(templateContext, NullEncoder.Default)
.Replace("\r", String.Empty).Replace("\n", String.Empty);
Copy link
Member

Choose a reason for hiding this comment

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

Why not just trim. If there are space in the middle of the string they should be intentional. I could understand that having a new line in a fluid template might be hardly noticeable though.

Copy link
Member

Choose a reason for hiding this comment

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

Can we use Environment.NewLine instead?

Copy link
Contributor Author

@neglectedvalue neglectedvalue May 26, 2022

Choose a reason for hiding this comment

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

Instead of "\n"? So result will be smth like :
options.BucketName = template .Render(templateContext, NullEncoder.Default) .Replace("\r", String.Empty) .Replace(System.Environment.NewLine, String.Empty) .Trim();

Copy link
Member

Choose a reason for hiding this comment

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

Environment.NewLine insstead of \r\n

Copy link
Member

Choose a reason for hiding this comment

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

options.BucketName = template .Render(templateContext, NullEncoder.Default) .Replace(Environment.NewLine, String.Empty)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So guys, should i rollback my latest commit? :)

Copy link
Member

Choose a reason for hiding this comment

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

I think it is safer, but keep the trim

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Copy link
Member

Choose a reason for hiding this comment

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

I would have let the replace of \r and \n.

Is there anything wrong with Environment.NewLine?

Copy link
Member

Choose a reason for hiding this comment

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

@hishamco
Copy link
Member

Just a note to @agriffard please add it as a contributor once the PR is merged

@Piedone
Copy link
Member

Piedone commented May 30, 2022

@jtkech anything you'd like to add or would you approve, please?

@jtkech
Copy link
Member

jtkech commented May 30, 2022

Related to the comments I did, that's okay for me.
Didn't look at all things, but LGTM so I will approve.

@Piedone Piedone merged commit 187327c into OrchardCMS:main May 30, 2022
@Piedone
Copy link
Member

Piedone commented May 30, 2022

Congrats @neglectedvalue and thank you for this contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants