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

avoid error if display name not set #277

Closed
wants to merge 1 commit into from

Conversation

jmcclelland
Copy link

If display name is not set or if running for a user that doesn't exist (as reported in #111 - which does not seem to be fixed), I get:

An unhandled exception has been thrown:,TypeError: json_decode(): Argument #1 ($json) must be of type string, bool given in /usr/local/src/nextcloud/27.0.1-mayfirst/apps/user_usage_report/lib/Reports/SingleUser.php:218,Stack trace:,#0 /usr/local/src/nextcloud/27.0.1-mayfirst/apps/user_usage_report/lib/Reports/SingleUser.php(218): json_decode(),#1 /usr/local/src/nextcloud/27.0.1-mayfirst/apps/user_usage_report/lib/Reports/SingleUser.php(72): OCA\UserUsageReport\Reports\SingleUser->getUserDisplayName(),#2 /usr/local/src/nextcloud/27.0.1-mayfirst/apps/user_usage_report/lib/Command/Generate.php(177): OCA\UserUsageReport\Reports\SingleUser->printReport(),#3 /usr/local/src/nextcloud/27.0.1-mayfirst/3rdparty/symfony/console/Command/Command.php(298): OCA\UserUsageReport\Command\Generate->execute(),#4 /usr/local/src/nextcloud/27.0.1-mayfirst/3rdparty/symfony/console/Application.php(1040): Symfony\Component\Console\Command\Command->run(),#5 /usr/local/src/nextcloud/27.0.1-mayfirst/3rdparty/symfony/console/Application.php(301): Symfony\Component\Console\Application->doRunCommand(),#6 /usr/local/src/nextcloud/27.0.1-mayfirst/3rdparty/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun(),#7 /usr/local/src/nextcloud/27.0.1-mayfirst/lib/private/Console/Application.php(211): Symfony\Component\Console\Application->run(),#8 /usr/local/src/nextcloud/27.0.1-mayfirst/console.php(100): OC\Console\Application->run(),#9 /usr/local/src/nextcloud/27.0.1-mayfirst/occ(11): require_once('...'),#10

kesselb added a commit that referenced this pull request Jun 25, 2024
- Load the display name if requested
- Let getUserDisplyName return null as expected by the formatter
- User oc_accounts_data instead of oc_accounts (to avoid the json parsing)

Based on #277

Signed-off-by: Daniel Kesselberg <[email protected]>
@kesselb
Copy link
Collaborator

kesselb commented Jun 25, 2024

Thank you for your pull request 👍

The formatter can handle a missing display name when null is given.

I picked up your changes with #282 and will release a new version soon.

@kesselb kesselb closed this Jun 25, 2024
backportbot bot pushed a commit that referenced this pull request Jun 27, 2024
- Load the display name if requested
- Let getUserDisplyName return null as expected by the formatter
- User oc_accounts_data instead of oc_accounts (to avoid the json parsing)

Based on #277

Signed-off-by: Daniel Kesselberg <[email protected]>
backportbot bot pushed a commit that referenced this pull request Jun 27, 2024
- Load the display name if requested
- Let getUserDisplyName return null as expected by the formatter
- User oc_accounts_data instead of oc_accounts (to avoid the json parsing)

Based on #277

Signed-off-by: Daniel Kesselberg <[email protected]>
Copy link
Contributor

github-actions bot commented Jul 2, 2024

Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.

We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process.

Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6

Thank you for contributing to Nextcloud and we hope to hear from you soon!

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

Successfully merging this pull request may close these issues.

2 participants