edwardspec / mediawiki-aws-s3

Extension:AWS allows MediaWiki to use Amazon S3 (instead of the local directory) to store images.
https://www.mediawiki.org/wiki/Extension:AWS
GNU General Public License v2.0
42 stars 32 forks source link

img_auth is not used in VisualEditor #43

Closed jeffw16 closed 3 years ago

jeffw16 commented 3 years ago

When img_auth is used in combination with the AWS S3 extension, the $wgUploadPath directive is not respected on VisualEditor. This results in the image files not showing up in VisualEditor. I don't think this happened with VisualEditor in the past, it only started to occur when I moved files over to S3.

image

edwardspec commented 3 years ago

This is an issue with VisualEditor (or, more likely, Parsoid). Please report it on Wikimedia Phabricator. It may affect other extensions (not just Extension:AWS), and there is no quick workaround that we can add on the side of Extension:AWS.

jeffw16 commented 3 years ago

Well, please look at my last sentence in my first post. This didn't happen before moving to S3. So, what might be the reason behind this? I'm not going to report this on the Wikipedia Phabricator just yet, because I feel like that will just result in a blame game with nobody taking the responsibility for this problem. There is a chance it is something wrong with both extensions. I would urge you to not so quickly and hastily close this ticket without even explaining in detail why this is an "invalid" bug report.

edwardspec commented 3 years ago

I did preliminary investigation of "can this be caused by Extension:AWS" before closing the ticket. Again: there is no bug on the side of Extension:AWS. So I can't fix it here. Feel free to contact other developers for a second opinion.

Please contact me by email if you need me to investigate/fix bugs in other software (not developed by me) on commercial basis.

jeffw16 commented 3 years ago

I found the problem.

At the moment, VisualEditor requires $wgGroupPermissions['*']['read'] = true; to function on private wikis. And on this extension, even if img_auth is used for a public wiki, the setting is completely ignored. Please see this change I made: https://github.com/mywikis/AWS-S3/commit/a57483e880a255f782861f90c0a7bd946080cf3d

While this isn't necessarily the AWS S3 extension's prerogative to fix this problem, I would like to propose the ability to use img_auth in public wikis if so desired. While this might be slower, there are legitimate use cases for doing so, such as when you don't want to make your S3 bucket files public.

edwardspec commented 3 years ago

At the moment, VisualEditor requires $wgGroupPermissions['*']['read'] = true; to function on private wikis

Have you tried the following configuration:

$wgVirtualRestConfig['modules']['parsoid']['forwardCookies'] = true;
jeffw16 commented 3 years ago

As you may know, doing that on MediaWiki 1.35 invalidates the ability to use the local Parsoid PHP instance. Therefore, that is not an option. https://www.mediawiki.org/wiki/Topic:Vv35plp6g16qno0s

edwardspec commented 3 years ago

Again, this is Parsoid issue and should be fixed in Parsoid.

I would like to propose the ability to use img_auth in public wikis if so desired

Please use configuration style from https://github.com/edwardspec/mediawiki-aws-s3/blob/master/tests/travis/OldStyleAWSSettings.php (without $wgAWSBucketName). This allows you to set $wgLocalFileRepo manually, meaning that you can use any URL you want, including img_auth.php for everything on public wiki.

This will solve your problem completely. Adding $wg variables for every rare configuration that is needed for less than 1% of wikis will just overcomplicate things.

jeffw16 commented 3 years ago

Again, this is Parsoid issue and should be fixed in Parsoid.

Yes, we both agree on that. Nobody is saying that this is the AWS extension's problem (anymore). But I am putting this info here for future reference and to help people who have the same issue.

And thank you for the insight, that is sufficient. As long as there is a way to fix it without editing the code, that will be fine with me. Appreciate your help!