Hello Alan, 

Here is the patch :

=== modified file 'mira-client/src/utilities/files/WorkplaceFilesWidget.cpp'
--- mira-client/src/utilities/files/WorkplaceFilesWidget.cpp    2010-12-14 
18:04:57 +0000
+++ mira-client/src/utilities/files/WorkplaceFilesWidget.cpp    2011-06-01 
07:38:27 +0000
@@ -300,6 +300,12 @@
     if (m_line_edit->text().isEmpty())
         return;
 
+    if(!boost::filesystem::portable_name(m_line_edit->text().toStdString()))
+    {
+        QMessageBox::warning(this, "Invalid file name!","'" + 
m_line_edit->text() + "' isn't a valid file name", QMessageBox::Ok);
+        return;
+    }
+
     path_type current_path = get_current_path();
     current_path /= m_line_edit->text().toStdString();

Thanks
-- 
Abdellaoui Zied

Tel:   +216 96 309 609

ITZ:    [GMT+1]        
email: zied_abdella...@hotmail.com




> From: aalva...@aliensoft.net
> Date: Tue, 31 May 2011 12:14:32 -0400
> To: mira-development@lists.sourceforge.net
> Subject: Re: [Mira-development] Bug #701290 :crash when Create Folder with 
> special characters
> 
> Hello Abdellaoui,
> 
>     This looks like a good fix. Could you create a patch against the
> branch you're working on with "bzr diff" and send it to the list?
> 
> I'll apply and submit to trunk and my branch.
> 
> Thanks.
> 
> 2011/5/31 zied abdellaoui <zied_abdella...@hotmail.com>:
> >
> > Here is the attached file.
> > --
> > Abdellaoui Zied
> >
> > Tel:   +216 96 309 609
> >
> > ITZ:    [GMT+1]
> > email: zied_abdella...@hotmail.com
> >
> >
> >
> >
> > ________________________________
> > From: zied_abdella...@hotmail.com
> > To: mira-development@lists.sourceforge.net
> > Date: Tue, 31 May 2011 16:49:59 +0100
> > Subject: [Mira-development] Bug #701290 :crash when Create Folder with
> > special characters
> >
> > Hi
> >
> > I took a look at the Bug #701290 and I suggest this solution :
> > I suggest that protection against wrong file name will be done on the client
> > side. I do an enhancement by modifying the slot function
> > 'create_folder_clicked' in WorkplaceFilesWidget class. I added a simple test
> > using boost function 'portable_name(std::string)'. briefly this function
> > tests if the string passed in parameter can be a suitable file name, either
> > in Windows or Linux , or not
> > (http://www.boost.org/doc/libs/1_33_1/libs/filesystem/doc/portability_guide.htm)
> > So the test on 'm_line_edit' will be extended and it will look like this :
> > if (m_line_edit->text().isEmpty())
> > return;
> > if(!boost::filesystem::portable_name(m_line_edit->text().toStdString()))
> > {
> > QMessageBox::warning(this, "Invalid file name!","'" + m_line_edit->text() +
> > "' isn't a valid file name", QMessageBox::Ok);
> > return;
> > }
> >
> > By this few lines the issue seems to be avoided. see the attached image with
> > the message when we use a special character as a folder name.
> > What do you think ?
> > ------------------------------------------------------------------------------
> > Simplify data backup and recovery for your virtual environment with vRanger.
> > Installation's a snap, and flexible recovery options mean your data is safe,
> > secure and there when you need it. Data protection magic? Nope - It's
> > vRanger. Get your free trial download today.
> > http://p.sf.net/sfu/quest-sfdev2dev
> > _______________________________________________ Mira-development mailing
> > list Mira-development@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/mira-development
> > ------------------------------------------------------------------------------
> > Simplify data backup and recovery for your virtual environment with vRanger.
> > Installation's a snap, and flexible recovery options mean your data is safe,
> > secure and there when you need it. Data protection magic?
> > Nope - It's vRanger. Get your free trial download today.
> > http://p.sf.net/sfu/quest-sfdev2dev
> > _______________________________________________
> > Mira-development mailing list
> > Mira-development@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/mira-development
> >
> >
> 
> 
> 
> -- 
> regards,
> 
> Alan Alvarez
> 
> ------------------------------------------------------------------------------
> Simplify data backup and recovery for your virtual environment with vRanger. 
> Installation's a snap, and flexible recovery options mean your data is safe,
> secure and there when you need it. Data protection magic?
> Nope - It's vRanger. Get your free trial download today. 
> http://p.sf.net/sfu/quest-sfdev2dev
> _______________________________________________
> Mira-development mailing list
> Mira-development@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mira-development
                                          
=== modified file 'mira-client/src/utilities/files/WorkplaceFilesWidget.cpp'
--- mira-client/src/utilities/files/WorkplaceFilesWidget.cpp    2010-12-14 
18:04:57 +0000
+++ mira-client/src/utilities/files/WorkplaceFilesWidget.cpp    2011-06-01 
07:38:27 +0000
@@ -300,6 +300,12 @@
     if (m_line_edit->text().isEmpty())
         return;
 
+    if(!boost::filesystem::portable_name(m_line_edit->text().toStdString()))
+    {
+        QMessageBox::warning(this, "Invalid file name!","'" + 
m_line_edit->text() + "' isn't a valid file name", QMessageBox::Ok);
+        return;
+    }
+
     path_type current_path = get_current_path();
     current_path /= m_line_edit->text().toStdString();
 

------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger. 
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Data protection magic?
Nope - It's vRanger. Get your free trial download today. 
http://p.sf.net/sfu/quest-sfdev2dev
_______________________________________________
Mira-development mailing list
Mira-development@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mira-development

Reply via email to