Bug 433378

Summary: Configuration Files: "File Is Too Large to Edit" should display MAX_EDITABLE_SIZE instead of CONFIG_REVISION_MAX_SIZE
Product: Red Hat Satellite 5 Reporter: Issue Tracker <tao>
Component: ServerAssignee: John Matthews <jmatthew>
Status: CLOSED CURRENTRELEASE QA Contact: Michael Mráka <mmraka>
Severity: medium Docs Contact:
Priority: medium    
Version: 500CC: cperry, mpoole, msuchy, pkilambi, tao, xdmoon
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: sat530 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-09-10 20:24:01 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 456985, 469732    

Description Issue Tracker 2008-02-18 22:18:23 UTC
Escalated to Bugzilla from IssueTracker

Comment 4 Jesus M. Rodriguez 2008-04-17 02:49:20 UTC
*** Bug 429123 has been marked as a duplicate of this bug. ***

Comment 6 Michael Mráka 2009-01-12 12:37:12 UTC
Files smaller than 32k are editable, larger display File Is Too Large to Edit message.

Verified: Satellite-5.3.0-RHEL5-re20081223.1-i386

Comment 7 Miroslav Suchý 2009-08-04 12:30:04 UTC
verified in stage

Comment 8 Brandon Perkins 2009-09-10 20:24:01 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHEA-2009-1434.html

Comment 10 Xixi 2011-02-04 20:20:05 UTC
Setting this bug to public so that it's more visible, and here's a digest of the private updates:

Description of problem:
Configuration files cannot be larger than 32k to be edited in Satellite 5.0

How reproducible:
Every time

Steps to Reproduce:
1) Upload a configuration file larger than 32k (for example, 32.5k)
2) Try to edit configuration file

Actual results:
Satellite complains that the file is to large to be edited and that it must be
less than 128k to be edited. 

Expected results:
No error message, either 32k or 128k should be the upper limit for editable
configuration file. The message in this form is highly misleading, to say the
least.

Additional info:

Comment 2 Issue Tracker 2008-02-18 17:18:27 EST
relevant code snippets:

rhn-java-sat-5.0.0/code/src/com/redhat/rhn/frontend/action/configuration/files/FileDetailsAction.java
...
        request.setAttribute(MAX_SIZE,
                StringUtil.displayFileSize(
                       
Config.get().getInt(Config.CONFIG_REVISION_MAX_SIZE,
                               
Config.DEFAULT_CONFIG_REVISION_MAX_SIZE)));

        request.setAttribute(REV_TOTAL_SIZE,
StringUtil.displayFileSize(totalBytes));
        request.setAttribute(REV_SIZE,
                StringUtil.displayFileSize(
                       
cr.getConfigContent().getFileSize().longValue()));
...

rhn-java-sat-5.0.0/code/src/com/redhat/rhn/common/conf/Config.java: 
...
    public static final String CONFIG_REVISION_MAX_SIZE =
"web.maximum_config_file_size";
...
    public static final int DEFAULT_CONFIG_REVISION_MAX_SIZE = 131072;
...

/etc/rhn/default/rhn_web.conf:
...
# maximum size for a config file
web.maximum_config_file_size = 131072
...

<source>File Is Too Large to Edit</source>
        <context-group name="ctx">
          <context
context-type="sourcefile">/rhn/configuration/file/FileDetails.do</context>
        </context-group>
     </trans-unit>
        <trans-unit id="filedetails.contents.jspf.toolarge-edit">
<source>

rhn-java-sat-5.0.0/code/webapp/WEB-INF/pages/common/fragments/configuration/files/contents.jspf:
...
      <c:when test="${toolarge}">
                <strong><bean:message
key="filedetails.contents.jspf.toolarge-header"/></strong><br />
                <bean:message
key="filedetails.contents.jspf.toolarge-edit"
arg0="${requestScope.maxbytes}"/>
                <p />
                <strong><bean:message
key="filedetails.contents.jspf.download-header"/></strong><br />
                <bean:message key="filedetails.contents.jspf.download"
                       
arg0="/rhn/configuration/file/FileDownload.do?crid=${revision.id}&amp;cfid=${revision.configFile.id}"
                      
arg1="${fn:escapeXml(revision.configFile.configFileName.path)}"
                        arg2="${revision.revision}"
                        arg3="${revbytes}"/>
      </c:when>
...


rhn-java-sat-5.0.0/code/src/com/redhat/rhn/frontend/action/configuration/files/FileDetailsAction.java
...
        request.setAttribute(MAX_SIZE,
                StringUtil.displayFileSize(
                       
Config.get().getInt(Config.CONFIG_REVISION_MAX_SIZE,
                               
Config.DEFAULT_CONFIG_REVISION_MAX_SIZE)));
...

rhn-java-sat-5.0.0/code/src/com/redhat/rhn/frontend/action/configuration/ConfigFileForm.java
...
    // This cannot be the right way to find this
    // Here to deal with form-size-limits
    public static final long   MAX_EDITABLE_SIZE = (32L * 1024L);
...
        Boolean toolarge = new Boolean(
                cr.getConfigContent().getFileSize().longValue() >
MAX_EDITABLE_SIZE);
        request.setAttribute(REV_TOOLARGE, toolarge);
...

Comment 3 Xixi 2008-02-18 17:27:33 EST 
There's confusion between CONFIG_REVISION_MAX_SIZE and
MAX_EDITABLE_SIZE when the error message is displayed - the former is how big a
config file can be (default 128 KB), the latter is how big a config file can be
to still be edited via the UI due to form size limitations (hard-coded 32KB). 
In the Config file UI, the test for the "toolarge" is done with
MAX_EDITABLE_SIZE, which is correct, but the error displayed to the user with
"maxbytes" which is set to CONFIG_REVISION_MAX_SIZE, this is incorrect &
misleads the user. The UI needs to differentiate between MAX_EDITABLE_SIZE and
CONFIG_REVISION_MAX_SIZE - perhaps make a new param called "maxeditbytes".

Comment 5 John Matthews 2008-11-05 17:46:46 EST
Copied to spacewalk bug 470149
Fixed in commit:
http://git.fedorahosted.org/git/?p=spacewalk.git;a=commit;h=37e91c989cb1656c71ff5e543cf572d44a46560a

WebUI now displays:
"File Is Too Large to Edit
You can't edit this file here because it is too large (files must be less than
32 KB to be editable in this form). You can, however, download this file, edit
it locally on your computer, and upload your changes here."