[bug] Compatibility issue for Firefox 3

Former SVN Browser
leeyc0
Posts: 1
Joined: Tue Jul 22, 2008 1:27 pm

[bug] Compatibility issue for Firefox 3

Postby leeyc0 » Tue Jul 22, 2008 1:37 pm

I have discovered a compatibility issue for Firefox 3. Seems that the value of tag <input type="file"> is different. It doesn't contain the full path, just the file name without path. It would cause the file update page's file name checking javascript to fail. (To be exact, it would be svnwebclient/include/dialog/fileUpdateContent.jsp, that is, uploading a new version of an existing file). It assumed it is a full path which either contains "/" or "\".) I have to modify the source code to cope with this issue.

Here is the patch that would fix this issue.

Code: Select all

--- include/dialog/fileUpdateContent.jsp        2008-04-14 14:47:48.000000000 +0800
+++ include/dialog/fileUpdateContent.jsp        2008-07-22 21:33:46.000000000 +0800
@@ -26,16 +26,17 @@
                     if(slashIdx == -1) {
                         slashIdx = entered_filename.lastIndexOf('/');
                     }
-                    if(slashIdx != -1) {
+                    // Firefox 3 changed the input type=file form input. There is already no path in the form value.
+                    //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');
+                    //}
                 } else {
                     alert('File name must be the same as stored on the server');
                 }

luisperilla
Posts: 1
Joined: Tue Dec 03, 2013 1:53 pm

Re: [bug] Compatibility issue for All browsers

Postby luisperilla » Tue Dec 03, 2013 3:35 pm

This change works with all browsers. replace All!
Regards, Luis

Code: Select all

<%--
  - Copyright (c) 2004, 2005 Polarion Software, All rights reserved.
  - Email: community@polarion.org
  -
  - This program and the accompanying materials are made available under the
  - terms of the Apache License, Version 2.0 (the "License"). You may not use
  - this file except in compliance with the License. Copy of the License is
  - located in the file LICENSE.txt in the project distribution. You may also
  - obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
  -
  -
  - POLARION SOFTWARE MAKES NO REPRESENTATIONS OR WARRANTIES
  - ABOUT THE SUITABILITY OF THE SOFTWARE, EITHER EXPRESSED OR IMPLIED,
  - INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY,
  - FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. POLARION SOFTWARE
  - SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT
  - OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
  --%>
<script>
        function uploadFile(){
                var originalname = document.getElementById('originalname').value;
                var 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);

                        alert(originalname + " == " + entered_filename);
                        if (entered_filename != originalname) {
                                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');
                }
                return false;
        }
</script>
<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="padding:0;margin:0;" onSubmit="return uploadFile()">
    <input type="hidden" name="originalname" id="originalname" value="<%=bean.getFilename()%>"/>

    <table class="dialogcontent" cellspacing="0" cellpadding="0" width="100%" height="100%">
        <tr>
            <td>
                <b>File path:</b>
            </td>
        </tr>
        <tr>
            <td>
                <input type="file" id="filepath" name="filepath" style="width:100%;margin:0;font-size:11px;"/>
            </td>
        </tr>   
        <tr>
            <td style="padding-top:10px;">
                <b>Comment:</b>
            </td>
        </tr>
        <tr>
            <td>
                <textarea id="comment" name="comment" rows="5" style="width:100%;margin:0;font-size:11px;">File updated remotely</textarea>
            </td>
        </tr>   
        <tr>
            <td width="100%" style="padding-top:20px;padding-bottom:0px;">
                <table cellspacing="0" cellpadding="0" width="100%">
                    <tr>
                        <td align="left">
                            <input type="submit" class="button" value="OK"/>               
                        </td>
                        <td align="left" style="padding-left:10px;">
                            <input type="button" class="button" value="Cancel" onclick="javascript:window.location='<%=bean.getCancelUrl()%>'"/>               
                        </td>     
                        <td width="100%"/>
                    </tr>
                </table>
            </td>   
        </tr>   
    </table>
</form>

idsocho
Posts: 2
Joined: Wed Mar 11, 2015 5:48 am

Re: [bug] Compatibility issue for Firefox 3

Postby idsocho » Wed Mar 11, 2015 6:44 am

How to enable syntax highlighting of code in Delphi / Pascal?

Thank you


Return to “Polarion SVN Web Client”

Who is online

Users browsing this forum: No registered users and 2 guests