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

[17.0][IMP] fs_storage: replace {db_name} in directory_path #379

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

Conversation

vincent-hatakeyama
Copy link

In multi database mode, there was no way to avoid filename collisions.

In multi database mode, without using that feature in fs_attachment, as the created filename does not contain the database name, it is possible to overwrite files from another database if obfuscation is off and the file have the same name and the same id or cause deletion of files if the checksum is used as the name and the same file is copied over several database and unlinked in one of them.
I would have prefer for the name of the file to always include the database name but I think it would have been a major change considered too breaking. Allowing to use the database name seemed more compatible.

In multi database mode, there was no way to avoid filename collisions
@vincent-hatakeyama vincent-hatakeyama changed the title [IMP] fs_storage: replace {db_name} in directory_path [17.0][IMP] fs_storage: replace {db_name} in directory_path Jun 24, 2024
@lmignon
Copy link
Contributor

lmignon commented Jun 28, 2024

@vincent-hatakeyama you should use one backend by database. IMO this change is useless.

Copy link
Member

@sbidoul sbidoul left a comment

Choose a reason for hiding this comment

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

The use case is unclear to me and this could indeed be solved with a different backend configuration per database.

I can imagine this could facilitate the automatic creation of that backend.

This would need a test, and an update of the help text of the field to reveal the feature to users.

# replace {db_name} with the dbname
if field_name == "directory_path":
value = value.format(db_name=self.env.cr.dbname)
return value
Copy link
Member

Choose a reason for hiding this comment

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

This is also probably not the best place to implement this, as if we do this, it should not behave differently when the value is entered manually or via server environment.

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

Successfully merging this pull request may close these issues.

3 participants