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 application not saved in external file type #12321

Merged
merged 1 commit into from
Dec 21, 2024
Merged

Conversation

Siedlerchr
Copy link
Member

@Siedlerchr Siedlerchr commented Dec 21, 2024

Fixes #12311

File extension uniqueness checks does not make sense oneedit when ext didn't change

Mandatory checks

  • I own the copyright of the code submitted and I licence it under the MIT license
  • Change in CHANGELOG.md described in a way that is understandable for the average user (if change is visible to the user)
  • Tests created for changes (if applicable)
  • Manually tested changed features in running JabRef (always required)
  • Screenshots added in PR description (for UI changes)
  • Checked developer's documentation: Is the information available and up to date? If not, I outlined it in this pull request.
  • Checked documentation: Is the information available and up to date? If not, I created an issue at https://github.com/JabRef/user-documentation/issues or, even better, I submitted a pull request to the documentation repository.

@Siedlerchr Siedlerchr added the status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Dec 21, 2024
Copy link
Contributor

github-actions bot commented Dec 21, 2024

The build for this PR is no longer available. Please visit https://builds.jabref.org/main/ for the latest build.

@Siedlerchr Siedlerchr enabled auto-merge December 21, 2024 12:40
@Siedlerchr Siedlerchr added this pull request to the merge queue Dec 21, 2024
Merged via the queue into main with commit 14bc706 Dec 21, 2024
27 of 28 checks passed
@Siedlerchr Siedlerchr deleted the fixExternalFileTypes branch December 21, 2024 12:57
@koppor
Copy link
Member

koppor commented Dec 21, 2024

The PR is a follow-up to #10496.

@@ -82,7 +82,12 @@ public boolean edit(ExternalFileTypeItemViewModel type) {
ExternalFileTypeItemViewModel typeToModify = new ExternalFileTypeItemViewModel(type.toExternalFileType());
showEditDialog(typeToModify, Localization.lang("Edit file type"));

if (!isValidExternalFileType(typeToModify)) {
if (type.extensionProperty().get().equals(typeToModify.extensionProperty().get())) {
Copy link
Member

Choose a reason for hiding this comment

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

I have no clue why this works. Can you add a Java comment?

In my understanding, this evaluates to true if the extension is the same (either empty or set). Then the check withEmptyValue is done.

In the "old" branch, the withEmptyValue is also done (indirectly via isValidExternalFileType.

I really don't get why this fixes the issue ^^.

Copy link
Member Author

Choose a reason for hiding this comment

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

The isValidExternalType checks if the file extension is already used before. This will always return true in the case of edit and return false -> thus you can never edit one file typ entry.
Therefore, we check if we still have the same extension -> we just edited an existing one by e.g. changing the application path

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to set custom application path for external file types
3 participants