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

Strange check for unique file names in article storage #1328

Closed
bschmalhofer opened this issue Oct 16, 2021 · 2 comments
Closed

Strange check for unique file names in article storage #1328

bschmalhofer opened this issue Oct 16, 2021 · 2 comments
Assignees
Labels
tidying Tidying of the code
Milestone

Comments

@bschmalhofer
Copy link
Contributor

Here is some code from Kernel/System/Ticket/Article/Backend/MIMEBase/ArticleStorageFS.pm .

for ( my $i = 1; $i <= 50; $i++ ) {
    if ( exists $UsedFile{ Unicode::Normalize::NFC($NewFileName) } ) {
        if ( $Param{Filename} =~ /^(.*)\.(.+?)$/ ) {
            $NewFileName = "$1-$i.$2";
        }
        else {
            $NewFileName = "$Param{Filename}-$i";
        }
    }
}

Looks like a last is missing there. Maybe this was never noticed because attachments are sorted alphabetically.

@bschmalhofer bschmalhofer added the tidying Tidying of the code label Oct 16, 2021
@bschmalhofer bschmalhofer added this to the OTOBO 10.1 milestone Oct 16, 2021
@bschmalhofer bschmalhofer self-assigned this Oct 16, 2021
bschmalhofer added a commit that referenced this issue Nov 4, 2021
in the article storages backend modules
bschmalhofer added a commit that referenced this issue Nov 4, 2021
mostly for reducing the diffs between the article storage backends
bschmalhofer added a commit that referenced this issue Nov 4, 2021
bschmalhofer added a commit that referenced this issue Nov 4, 2021
@bschmalhofer
Copy link
Contributor Author

Did some tidying of the three article storage backends. The goal being that the code becomes more similar accross the modules.
The logic for creating the unique file names is left in place. There might be a good reason for why the checks are done this way. At least there are no bug reports about the current approach.

Closing only after the next run of the test suite.

@bschmalhofer bschmalhofer modified the milestones: OTOBO 10.1, OTOBO 10.1.1 Nov 11, 2021
@bschmalhofer
Copy link
Contributor Author

The latest run of the test suite looked fine. Closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tidying Tidying of the code
Projects
None yet
Development

No branches or pull requests

1 participant