-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Conversation
I was planned to make this for Orchard Core Contrib (OCC), but it's good to see someone push a PR to implement it |
There was a problem hiding this 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/OrchardCore.FileStorage.AmazonS3/AmazonWebServiceResponseExtensions.cs
Outdated
Show resolved
Hide resolved
src/OrchardCore/OrchardCore.FileStorage.AmazonS3/AwsDirectory.cs
Outdated
Show resolved
Hide resolved
src/OrchardCore.Modules/OrchardCore.Media.AmazonS3/OrchardCore.Media.AmazonS3.csproj
Outdated
Show resolved
Hide resolved
src/OrchardCore.Modules/OrchardCore.Media.AmazonS3/OrchardCore.Media.AmazonS3.csproj
Outdated
Show resolved
Hide resolved
Co-authored-by: Zoltán Lehóczky <[email protected]>
Co-authored-by: Zoltán Lehóczky <[email protected]>
Co-authored-by: Zoltán Lehóczky <[email protected]>
….Media.AmazonS3.csproj Co-authored-by: Zoltán Lehóczky <[email protected]>
Co-authored-by: Zoltán Lehóczky <[email protected]>
…ions.cs Co-authored-by: Zoltán Lehóczky <[email protected]>
…ions.cs Co-authored-by: Zoltán Lehóczky <[email protected]>
…ptionsExtension.cs Co-authored-by: Zoltán Lehóczky <[email protected]>
Co-authored-by: Zoltán Lehóczky <[email protected]>
Please ask for a review (upper right corner) if you're done addressing all the feedback. |
Yes, sorry always forgetting about it. |
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.Modules/OrchardCore.Media.AmazonS3/AwsStorageOptionsExtension.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this 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.
src/OrchardCore.Modules/OrchardCore.Media.AmazonS3/AwsStorageOptionsConfiguration.cs
Outdated
Show resolved
Hide resolved
src/OrchardCore.Modules/OrchardCore.Media.AmazonS3/CreateMediaS3BucketEvent.cs
Outdated
Show resolved
Hide resolved
Oh, and also address #11738 (comment), please. |
…ptionsConfiguration.cs Co-authored-by: Zoltán Lehóczky <[email protected]>
…S3BucketEvent.cs Co-authored-by: Zoltán Lehóczky <[email protected]>
Co-authored-by: Zoltán Lehóczky <[email protected]>
There was a problem hiding this comment.
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("\r", String.Empty).Replace("\n", String.Empty); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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();
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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? :)
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already used quite often https://github.com/OrchardCMS/OrchardCore/search?q=NewLine
src/OrchardCore.Modules/OrchardCore.Media.AmazonS3/AwsStorageOptionsConfiguration.cs
Outdated
Show resolved
Hide resolved
src/OrchardCore.Modules/OrchardCore.Media.AmazonS3/AwsStorageOptionsConfiguration.cs
Outdated
Show resolved
Hide resolved
src/OrchardCore.Modules/OrchardCore.Media.AmazonS3/AwsStorageOptionsConfiguration.cs
Outdated
Show resolved
Hide resolved
src/OrchardCore.Modules/OrchardCore.Media.AmazonS3/AwsStorageOptionsConfiguration.cs
Show resolved
Hide resolved
src/OrchardCore.Modules/OrchardCore.Media.AmazonS3/AwsStorageOptionsConfiguration.cs
Show resolved
Hide resolved
Just a note to @agriffard please add it as a contributor once the PR is merged |
@jtkech anything you'd like to add or would you approve, please? |
Related to the comments I did, that's okay for me. |
Congrats @neglectedvalue and thank you for this contribution! |
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.