public inbox for [email protected]  
help / color / mirror / Atom feed
From: Aditya Toshniwal <[email protected]>
To: pgadmin-hackers <[email protected]>
Subject: [pgAdmin][RM4855] Renaming a file removes the file extension
Date: Mon, 28 Sep 2020 18:07:47 +0530
Message-ID: <CAM9w-_=xWqbhhM2ZL1KZf1aQVmTDqpRLJfgzOt9gUfG6RzR3ng@mail.gmail.com> (raw)

Hi Hackers,

Attached is the patch to fix a bug where extension file extension is
stripped on renaming a file.
Pleasure review.

-- 
Thanks,
Aditya Toshniwal
pgAdmin hacker | Sr. Software Engineer | *edbpostgres.com*
<http://edbpostgres.com;
"Don't Complain about Heat, Plant a TREE"


Attachments:

  [application/octet-stream] RM4855.patch (1.6K, 3-RM4855.patch)
  download | inline diff:
diff --git a/web/pgadmin/misc/file_manager/static/js/utility.js b/web/pgadmin/misc/file_manager/static/js/utility.js
index 78dfe8126..3494b127c 100644
--- a/web/pgadmin/misc/file_manager/static/js/utility.js
+++ b/web/pgadmin/misc/file_manager/static/js/utility.js
@@ -867,7 +867,7 @@ define([
         $('.fileinfo #contents li div').on('blur dblclick', 'input', function(e) {
           e.stopPropagation();
 
-          var old_name = decodeURI($(this).siblings('span').attr('title'));
+          var old_name = decodeURI($(this).siblings('div').find('.less_text').attr('title'));
           newvalue = old_name.substring(0, old_name.indexOf('.'));
           var last = getFileExtension(old_name),
             file_data, new_name, file_path, full_name;
@@ -945,7 +945,7 @@ define([
         $('.fileinfo table#contents tr td div').on(
           'blur dblclick', 'input',
           function(e) {
-            var old_name = decodeURI($(this).siblings('span').attr('title')),
+            var old_name = decodeURI($(this).siblings('div').find('.less_text').attr('title')),
               new_value = old_name.substring(0, old_name.indexOf('.')),
               last = getFileExtension(old_name);
             if (old_name.indexOf('.') == 0) {
@@ -974,8 +974,7 @@ define([
 
                 if (new_value !== new_name) {
                   renameItem(file_data);
-                  var parent = file_path.split('/').reverse().slice(2).reverse().join('/') + '/';
-                  getFolderInfo(parent);
+                  getFolderInfo($('.currentpath').val());
                 }
               }
             } else {


view thread (6+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected]
  Subject: Re: [pgAdmin][RM4855] Renaming a file removes the file extension
  In-Reply-To: <CAM9w-_=xWqbhhM2ZL1KZf1aQVmTDqpRLJfgzOt9gUfG6RzR3ng@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox