bicodrex commented on code in PR #9208:
URL: https://github.com/apache/netbeans/pull/9208#discussion_r2817167327


##########
ide/projectui/src/org/netbeans/modules/project/ui/zip/ExportZIP.java:
##########
@@ -477,7 +477,11 @@ public void actionPerformed(java.awt.event.ActionEvent 
evt) {
     private void zipButtonActionPerformed(java.awt.event.ActionEvent evt) 
{//GEN-FIRST:event_zipButtonActionPerformed
         JFileChooser fc = new JFileChooser();
         if (fc.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) {
-            zipField.setText(fc.getSelectedFile().getAbsolutePath());
+            String sf = fc.getSelectedFile().getAbsolutePath();
+            if(!sf.toLowerCase().endsWith(".zip")) {
+              sf += ".zip";
+            }

Review Comment:
   You're right, I didn't think about that, this way it's more robust.
   
   What do you think if instead of doing the check we just strip away the 
extension using something like `FilenameUtils::removeExtension` from Commons 
IO? This will handle the case where a user enter something like: `myfile.ZIP` 
or `myfile.txt.zip` or even `myfile.txt.ZIP`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to