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

Fix #8838 - Change logo even if tmp folder contains periods #10490

Open
wants to merge 1 commit into
base: hotfix
Choose a base branch
from

Conversation

SinergiaCRM
Copy link
Contributor

Description

This PR checks if the variable $ext contains a "/". If so, it means it is not an extension, so it should get the value of $path

Motivation and Context

A logo image can't be uploaded through Admin / System settings area if the tmp folder's name contains at least one period.

How To Test This

  1. Host a SuiteCRM instance where the tmp folder full path contains at least one period. For example /test.test/tmp
  2. Try to upload an image using through the Admin / System settings area and checks it is working.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Final checklist

  • My code follows the code style of this project found here.
  • My change requires a change to the documentation.
  • I have read the How to Contribute guidelines.

@serhiisamko091184 serhiisamko091184 added Status:Assessed PRs that have been tested and confirmed to resolve an issue by a core team member Branch:Hotfix PR 4-8 Score given to PRs once assessed Status: Requires Code Review Needs the core team to code review labels Aug 6, 2024
@serhiisamko091184
Copy link
Contributor

Thanks for the PR, @SinergiaCRM!

Regards,
Serhii

@serhiisamko091184 serhiisamko091184 added the Status:In Review Pull Requests that are activity being reviewed by the core team label Aug 26, 2024
@serhiisamko091184
Copy link
Contributor

Hello @SinergiaCRM,

I'd like to ask about the suggested control structure. The strpos function might return different values - bool and non-bool. Some of them might be evaluated as FALSE, for instance, 0 or "". In case of returning 0 as an index of the position, it could be treated as FALSE. The logic of the fix might be scrambled. What do you think?

Thanks in advance!

Regards,
Serhii

@serhiisamko091184 serhiisamko091184 removed the Status: Requires Code Review Needs the core team to code review label Aug 26, 2024
@SinergiaCRM
Copy link
Contributor Author

SinergiaCRM commented Aug 26, 2024

I'd like to ask about the suggested control structure. The strpos function might return different values - bool and non-bool. Some of them might be evaluated as FALSE, for instance, 0 or "". In case of returning 0 as an index of the position, it could be treated as FALSE. The logic of the fix might be scrambled. What do you think?

Hi @serhiisamko091184, you are right!

I see in php.net that strpos() returns false if the needle was not found so I think we can solve it in the following way.

    if (strpos($ext, '/') !== false) {
        $ext = $path;
    }

I just uploaded the change to PR.
Does this seem right to you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Branch:Hotfix PR 4-8 Score given to PRs once assessed Status:Assessed PRs that have been tested and confirmed to resolve an issue by a core team member Status:In Review Pull Requests that are activity being reviewed by the core team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants