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

AmazonS3 ContentType Bug #11128

Closed
RasenFx opened this issue Sep 9, 2018 · 7 comments
Closed

AmazonS3 ContentType Bug #11128

RasenFx opened this issue Sep 9, 2018 · 7 comments
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap bug feature: files feature: object storage needs info stale Ticket or PR with no recent activity

Comments

@RasenFx
Copy link

RasenFx commented Sep 9, 2018

Steps to reproduce

  1. I use AmazonS3 with Route53 and Cloud Front as webserver for HTML files
  2. I upload a HTML file to AmazonS3 through Nextcloud
  3. When I open the url the file downloads instead of execute like a normal HTML

Expected behaviour

I reviewed the file uploaded in S3 and the problem it's that NextCloud App (External Files) don't send the metadata that S3 need to know what do with the file and force to download the file, this happend with (jpg, pdf, html, etc) I fixed the problem in my server, the problem it's in this file: apps/files_external/lib/Lib/Storage/AmazonS3.php, line: 590 and I put the next code to solve the problem:

`

		/*$this->writeObject($path, $source);*/

		/* Start Fix */

		$path = $this->normalizePath($path);

		$mtime = null;

		$metadata = array();

		if (is_null($mtime)) {
			$mtime = time();
		}
		
		$metadata = [
			'lastmodified' => gmdate(\DateTime::RFC1123, $mtime)
		];
		
		$mimeType = \OC::$server->getMimeTypeDetector()->detectPath($path);
		
		$this->getConnection()->putObject([
			'Bucket' => $this->bucket,
			'Key' => $this->cleanKey($path),
			'Metadata' => $metadata,
			'Body' => $source,
			'ContentType' => $mimeType,
			'MetadataDirective' => 'REPLACE',
		]);
		/* End Fix */

`

I hope that this help thanks

Actual behaviour

Tell us what happens instead

Server configuration

Operating system:

Web server:

Database:

PHP version:

Nextcloud version: (see Nextcloud admin page)

Updated from an older Nextcloud/ownCloud or fresh install:

Where did you install Nextcloud from:

Signing status:

Signing status
Login as admin user into your Nextcloud and access 
http://example.com/index.php/settings/integrity/failed 
paste the results here.

List of activated apps:

App list
If you have access to your command line run e.g.:
sudo -u www-data php occ app:list
from within your Nextcloud installation folder

Nextcloud configuration:

Config report
If you have access to your command line run e.g.:
sudo -u www-data php occ config:list system
from within your Nextcloud installation folder

or 

Insert your config.php content here. 
Make sure to remove all sensitive content such as passwords. (e.g. database password, passwordsalt, secret, smtp password, …)

Are you using external storage, if yes which one: local/smb/sftp/...

Are you using encryption: yes/no

Are you using an external user-backend, if yes which one: LDAP/ActiveDirectory/Webdav/...

LDAP configuration (delete this part if not used)

LDAP config
With access to your command line run e.g.:
sudo -u www-data php occ ldap:show-config
from within your Nextcloud installation folder

Without access to your command line download the data/owncloud.db to your local
computer or access your SQL server remotely and run the select query:
SELECT * FROM `oc_appconfig` WHERE `appid` = 'user_ldap';


Eventually replace sensitive data as the name/IP-address of your LDAP server or groups.

Client configuration

Browser:

Operating system:

Logs

Web server error log

Web server error log
Insert your webserver log here

Nextcloud log (data/nextcloud.log)

Nextcloud log
Insert your Nextcloud log here

Browser log

Browser log
Insert your browser log here, this could for example include:

a) The javascript console log
b) The network log
c) ...
@nextcloud-bot
Copy link
Member

GitMate.io thinks possibly related issues are #3167 (Tedious bug tracker), #7031 (Possible password exposing bug), #9924 (Pdf view bug), #9170 (redirect), and #8241 (image).

@MorrisJobke MorrisJobke added feature: files feature: object storage bug 0. Needs triage Pending check for reproducibility or if it fits our roadmap labels Mar 26, 2019
@MorrisJobke
Copy link
Member

cc @rullzer @icewind1991

@stale
Copy link

stale bot commented Jun 6, 2019

This issue has been automatically marked as stale because it has not had recent activity and it seems to be missing some essential informations. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale Ticket or PR with no recent activity label Jun 6, 2019
@kesselb
Copy link
Contributor

kesselb commented Jun 6, 2019

Thanks a lot for digging 👍

Is this still happening? The code looks like your code already 🤔 For which version do you developed your patch?

@stale stale bot removed the stale Ticket or PR with no recent activity label Jun 6, 2019
@ghost
Copy link

ghost commented Jul 6, 2019

This issue has been automatically marked as stale because it has not had recent activity and it seems to be missing some essential informations. It will be closed if no further activity occurs. Thank you for your contributions.

@ghost ghost added the stale Ticket or PR with no recent activity label Jul 6, 2019
@kesselb
Copy link
Contributor

kesselb commented Jul 6, 2019

@RasenFx Would be cool if you could check that again.

@MorrisJobke
Copy link
Member

As there is no feedback since a while and we can't reproduce the issue I will close this ticket. If this is still happening please feel free to reopen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap bug feature: files feature: object storage needs info stale Ticket or PR with no recent activity
Projects
None yet
Development

No branches or pull requests

4 participants