Wicket
  1. Wicket
  2. WICKET-4421

content type (mime type) detection in ResourceStreamResource has false fallback

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Duplicate
    • Affects Version/s: 1.5.4
    • Fix Version/s: None
    • Component/s: wicket
    • Labels:
      None

      Description

      the content type (or mime type) detectiong deliveres a wrong mime type, if the file name is set, but the mime type is not know from the application.

      ResourceStreamResource Line 148 and the followings:

      final String contentType;
      if (fileName != null && Application.exists())

      { contentType = Application.get().getMimeType(fileName); }

      else

      { contentType = stream.getContentType(); }

      data.setContentType(contentType);

      When the mime type is not know from the application it is set to null and indifferent if the stream knows the correct mime type or not.
      I think the stream should be used as fallback if there is no mime type registered at the application, see:

      String contentType = null;
      if (fileName != null && Application.exists())

      { contentType = Application.get().getMimeType(fileName); }

      if(contentType == null)

      { contentType = stream.getContentType(); }

      data.setContentType(contentType);

      This solutions offers the benefit, that the user can provide the correct mime type through the ResourceStream.

        Issue Links

          Activity

          Transition Time In Source Status Execution Times Last Executer Last Execution Date
          Open Open Resolved Resolved
          10m 2s 1 Martin Grigorov 20/Feb/12 21:19
          Martin Grigorov made changes -
          Link This issue duplicates WICKET-4359 [ WICKET-4359 ]
          Martin Grigorov made changes -
          Field Original Value New Value
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Duplicate [ 3 ]
          Hide
          Martin Grigorov added a comment -

          This code has been improved in WICKET-4359 (1.5.5)

          Show
          Martin Grigorov added a comment - This code has been improved in WICKET-4359 (1.5.5)
          Johannes Unterstein created issue -

            People

            • Assignee:
              Unassigned
              Reporter:
              Johannes Unterstein
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development