Unable to upload file

Former SVN Browser
mad10341
Posts: 2
Joined: Sun Sep 07, 2008 12:44 pm

Unable to upload file

Postby mad10341 » Sun Sep 07, 2008 1:03 pm

Hi everybody.

I've just installed the SVN web client and while i was trying it i found the a strange error when trying to commit a file via web.
A dialogbox pops up, saying that the "filename should be the sabe as the name stored in the server". What's strange is that the file i'm trying to upload, it's just a new version of file stored in the server, with exactly the same name. Is this a bug, or i'm doing something worng?

Thanks in advance for replying,
MAD

mad10341
Posts: 2
Joined: Sun Sep 07, 2008 12:44 pm

Re: Unable to upload file

Postby mad10341 » Mon Sep 08, 2008 10:07 am

Hi,

Is there anyone with the same problem? I could really use some help here, because we need this functionality on a project that's already on a tight schedule.

MAD

dcumont
Posts: 3
Joined: Wed Sep 24, 2008 7:20 pm

Re: Unable to upload file

Postby dcumont » Wed Sep 24, 2008 7:22 pm

I've the same issue.

dcumont
Posts: 3
Joined: Wed Sep 24, 2008 7:20 pm

Re: Unable to upload file

Postby dcumont » Wed Sep 24, 2008 11:28 pm

I guess I found a solution. In the file "include/dialog/fileUpdateContent.jsp" change the existing javascript function by :


onSubmit="javascript:{
entered_filename = document.getElementById('filepath').value;
if (entered_filename.length>0) {
/*
slashIdx = entered_filename.lastIndexOf('\\');
if(slashIdx == -1) {
slashIdx = entered_filename.lastIndexOf('/');
}
if(slashIdx != -1) {
entered_filename = entered_filename.substring(slashIdx+1, entered_filename.length);
if (entered_filename != document.getElementById('originalname').value) {
alert('File name must be the same as stored on the server');
} else {
return true;
}
} else {
alert('File name must be the same as stored on the server');
}*/
if (entered_filename != document.getElementById('originalname').value) {
alert('File name must be the same as stored on the server (not identical)');
} else {
return true;
}
} else {
alert('File name must be the same as stored on the server (no filename)');
}
return false;
}">


This works fine.

Hope this helps,
David

nicusorb
Posts: 1
Joined: Thu Apr 08, 2010 2:45 pm

Re: Unable to upload file

Postby nicusorb » Thu Apr 08, 2010 2:50 pm

One solution that works in IE and Firefox is the following (modify in file "include/dialog/fileUpdateContent.jsp"):

<form name="fileUpdate" method="POST" enctype="multipart/form-data" action="<%=bean.getOkUrl()%>" style="padding:0;margin:0;"
onSubmit="javascript:{
entered_filename = document.getElementById('filepath').value;
if (entered_filename.length>0) {
slashIdx = entered_filename.lastIndexOf('\\');
if(slashIdx == -1) {
slashIdx = entered_filename.lastIndexOf('/');
}
if(slashIdx != -1) {
entered_filename = entered_filename.substring(slashIdx+1, entered_filename.length);
}

if (entered_filename != document.getElementById('originalname').value) {
alert('File name must be the same as stored on the server');
} else {
return true;
}
/*
} else {
alert('File name must be the same as stored on the server');
}
*/
} else {
alert('File name must be the same as stored on the server');
}
return false;
}">

Thanks,
Nicu

DanielBlackston
Posts: 1
Joined: Mon Oct 25, 2010 5:36 pm

Re: Unable to upload file

Postby DanielBlackston » Mon Oct 25, 2010 5:48 pm

Unfortunately, the above solutions only remove the filename checking.

The root cause of this problem is that the script doesn't need '\\' when indicating a single backslash


In file "webapps/svnwebclient/include/dialog/fileUpdateContent.jsp"

Find this code:

Code: Select all

<jsp:useBean id="bean" scope="request" type="org.polarion.svnwebclient.web.controller.file.FileUpdateBean"/>
<form name="fileUpdate" method="POST" enctype="multipart/form-data" action="<%=bean.getOkUrl()%>" style="paddi$
    onSubmit="javascript:{
               entered_filename = document.getElementById('filepath').value;
               if (entered_filename.length>0) {
                    slashIdx = entered_filename.lastIndexOf('\\');
                    if(slashIdx == -1) {
                        slashIdx = entered_filename.lastIndexOf('/');
                    }
                    if(slashIdx != -1) {
                        entered_filename = entered_filename.substring(slashIdx+1, entered_filename.length);
                        if (entered_filename != document.getElementById('originalname').value) {
                            alert('File name must be the same as stored on the server');
                        } else {
                            return true;
                        }
                    } else {
                        alert('File name must be the same as stored on the server');
                    }
                } else {
                    alert('File name must be the same as stored on the server');
                }
                return false;
            }">


Now change this:

Code: Select all

......
<form name="fileUpdate" method="POST" enctype="multipart/form-data" action="<%=bean.getOkUrl()%>" style="paddi$
    onSubmit="javascript:{
               entered_filename = document.getElementById('filepath').value;
               if (entered_filename.length>0) {
                    slashIdx = entered_filename.lastIndexOf('\\');
.......


Into this:

Code: Select all

......
<form name="fileUpdate" method="POST" enctype="multipart/form-data" action="<%=bean.getOkUrl()%>" style="paddi$
    onSubmit="javascript:{
               entered_filename = document.getElementById('filepath').value;
               if (entered_filename.length>0) {
                    slashIdx = entered_filename.lastIndexOf('\');
.......


The error is caused by the script mistakenly looking for double backslashes in filenames, while it should be looking for single backslashes.
Thus it cannot extract the filename of your file from the path provided, and can't compare the filename to the one on the server. Resulting in the error.
(Appearently, in javascript, you don't need a double backslash to indicate a single one, if you're putting it in single quotes)

selina
Posts: 1
Joined: Tue Apr 14, 2015 10:23 am

Re: Unable to upload file

Postby selina » Tue Apr 14, 2015 10:31 am

SVN Importer appears to ignore PVCS VM Promotion Groups which we specifically use to track environment snapshots. In all other respects our quite large VM archives are imported successfully but we really need the promotion group info, any ideas?
Lily lara


Return to “Polarion SVN Web Client”

Who is online

Users browsing this forum: No registered users and 2 guests