Skip to content

fix uncaught exception on not permitted file types when setting avatar, fixes #17232 - #17464

Merged
blizzz merged 4 commits into
masterfrom
fix-17232
Jul 29, 2015
Merged

blizzz merged 4 commits into
masterfrom
fix-17232

Conversation

@blizzz

@blizzz blizzz commented Jul 8, 2015

Copy link
Copy Markdown
Contributor

And refactors integration tests, because it adds one as well and we don't like to have code duplication, do we. The actual fix is just the third commit, which just adds a try-catch block and does some logging.

Please test and review @11mariom @hostingnuggets @MorrisJobke @tkaufm or others, thx.

@karlitschek also, request to backport to stable8.1 (complete), stable8 and stable7 (both fix only)

Fixes #17232

@blizzz blizzz added this to the 8.2-current-2015-10-15 milestone Jul 8, 2015
@ghost

ghost commented Jul 8, 2015

Copy link
Copy Markdown

🚀 Test PASSed.🚀
chuck

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Also log the full exception: \OCP\Util::logException('user_ldap', $e);... sometimes an exception only is a special class without a message ;)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Also or rather instead? It would mostly duplicate it (given the IAvatar PHPdoc is correct, only \Exception for a invalid format is to be expected, others that are thrown are ruled out before by biz logic - of course it may change over time), only with more details about the exception.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm fine with this :)

@MorrisJobke

Copy link
Copy Markdown
Contributor

Can those integration tests be executed on jenkins?

@blizzz

blizzz commented Jul 8, 2015

Copy link
Copy Markdown
Contributor Author

Can those integration tests be executed on jenkins?

Not at the moment, but it would be desirable.

For now, how you run them is documented here: https://github.com/owncloud/core/blob/master/apps/user_ldap/tests/integration/readme.md

Also it might make more sense to have something more general that we can use ownCloud wide.

@MorrisJobke

Copy link
Copy Markdown
Contributor

👍

@MorrisJobke

Copy link
Copy Markdown
Contributor

@davitol @SergioBertolinSG Can you help test this?

@MorrisJobke

Copy link
Copy Markdown
Contributor

@karlitschek also, request to backport to stable8.1 (complete), stable8 and stable7 (both fix only)

;)

@hostingnuggets

Copy link
Copy Markdown

+1 for backporting and please let us know which version will have this fix included.

@scrutinizer-notifier

Copy link
Copy Markdown

A new inspection was created.

@blizzz

blizzz commented Jul 27, 2015

Copy link
Copy Markdown
Contributor Author

rebased

@hostingnuggets is this a "I tested it and it works +1" or just an "i like it +1"?

@blizzz

blizzz commented Jul 27, 2015

Copy link
Copy Markdown
Contributor Author

@karlitschek backport request is pending

@karlitschek

Copy link
Copy Markdown
Contributor

backport is fine :-)

@blizzz

blizzz commented Jul 27, 2015

Copy link
Copy Markdown
Contributor Author

thank you :)

@MorrisJobke

Copy link
Copy Markdown
Contributor

@SergioBertolinSG @davitol @rperezb Can someone test this please? Thanks :)

@rperezb

rperezb commented Jul 28, 2015

Copy link
Copy Markdown

@MorrisJobke thanks for the ping, we have added this to the QA queue

@MorrisJobke

Copy link
Copy Markdown
Contributor

@PVince81 Can you test this to get it in? :)

@PVince81

Copy link
Copy Markdown
Contributor

@MorrisJobke I have no idea how to test this, especially how to put an avatar in LDAP.

@blizzz

blizzz commented Jul 28, 2015

Copy link
Copy Markdown
Contributor Author

I have no idea how to test this, especially how to put an avatar in LDAP.

#!/usr/bin/php
<?php


  $dn = 'uid=zombie29579,ou=zombies,dc=example,dc=com';
  $adn = 'uid=owncloudagent,ou=Users,dc=example,dc=com';
  $apwd = '123456';
  $jpeg = file_get_contents('/tmp/ava.jpg');
  $host = 'localhost';
  $port = 389;

  $jp = array('jpegPhoto' => $jpeg);

  $cr = ldap_connect($host, $port);
  ldap_set_option($cr, LDAP_OPT_PROTOCOL_VERSION, 3);
  ldap_bind($cr, $adn, $apwd);
  ldap_mod_add($cr, $dn, $jp);

@SergioBertolinSG

Copy link
Copy Markdown
Contributor

I've reproduced the 500 internal error in stable8.1. And I've tested it on stable8.1+this PR using a gif animated picture. Now there is no crash and the picture isn't shown (default picture with a character is shown instead). It says that the avatar is given by original account, but nothing about the format, perhaps not worthy to warn about it, just to have it clear. 👍

Working without problems using jpg and png.

@MorrisJobke

Copy link
Copy Markdown
Contributor

@owncloud-bot retest this please

@ghost

ghost commented Jul 29, 2015

Copy link
Copy Markdown

🚀 Test PASSed.🚀
chuck

blizzz added a commit that referenced this pull request Jul 29, 2015
fix uncaught exception on not permitted file types when setting avatar, fixes #17232
@blizzz
blizzz merged commit b0036ec into master Jul 29, 2015
@blizzz
blizzz deleted the fix-17232 branch July 29, 2015 10:37
blizzz added a commit that referenced this pull request Jul 29, 2015
…s when setting avatar

refactor integration tests to make it easier to add new ones

add integration tests for avatar update

fix uncaught exception on not permitted file types when setting avatar, fixes #17232

fix test after rebasing
@blizzz

blizzz commented Jul 29, 2015

Copy link
Copy Markdown
Contributor Author

Backport to stable8.1: #17951

@MorrisJobke

Copy link
Copy Markdown
Contributor

also, request to backport to stable8.1 (complete), stable8 and stable7 (both fix only)

@blizzz Are you also preparing the other two PRs? Thanks :)

@blizzz

blizzz commented Jul 29, 2015

Copy link
Copy Markdown
Contributor Author

@MorrisJobke yes, yes, right at it

@blizzz

blizzz commented Jul 29, 2015

Copy link
Copy Markdown
Contributor Author

Backport to stable8: #17953
Backport to stable7: #17954

DeepDiver1975 added a commit that referenced this pull request Aug 12, 2015
[stable8.1] Backport of #17464, fix uncaught exception on not permitted file type…
MorrisJobke added a commit that referenced this pull request Sep 28, 2015
[stable8] backport of #17464: fix uncaught exception on not permitted file types when setting avata…
@lock lock Bot locked as resolved and limited conversation to collaborators Aug 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LDAP - avatar in format other than jpg/png throws exception

8 participants