Ignore:
Timestamp:
2017-04-07T00:18:07+02:00 (2 years ago)
Author:
Don-vip
Message:

fix #14613 - Special HTML characters not escaped in GUI error messages

Location:
trunk/src/org/openstreetmap/josm/gui/io
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/io/ChangesetCellRenderer.java

    r11608 r11848  
    1515import org.openstreetmap.josm.data.osm.Changeset;
    1616import org.openstreetmap.josm.tools.ImageProvider;
     17import org.openstreetmap.josm.tools.Utils;
    1718import org.openstreetmap.josm.tools.date.DateUtils;
    1819
     
    4243        String comment = cs.get("comment");
    4344        if (comment != null) {
    44             sb.append("<strong>").append(tr("Changeset comment:")).append("</strong>").append(comment).append("<br>");
     45            sb.append("<strong>").append(tr("Changeset comment:")).append("</strong>")
     46              .append(Utils.escapeReservedCharactersHTML(comment)).append("<br>");
    4547        }
    4648        return sb.toString();
  • trunk/src/org/openstreetmap/josm/gui/io/SaveLayersTableColumnModel.java

    r10308 r11848  
    1616
    1717import org.openstreetmap.josm.tools.GBC;
     18import org.openstreetmap.josm.tools.Utils;
    1819
    1920class SaveLayersTableColumnModel extends DefaultTableColumnModel {
     
    4243            sb.append("<html>");
    4344            if (info != null) {
     45                String htmlInfoName = Utils.escapeReservedCharactersHTML(info.getName());
    4446                if (info.getLayer().requiresUploadToServer() && !info.getLayer().isUploadDiscouraged()) {
    4547                    panel.add(needsUpload, defaultCellStyle);
    46                     sb.append(tr("Layer ''{0}'' has modifications which should be uploaded to the server.", info.getName()));
     48                    sb.append(tr("Layer ''{0}'' has modifications which should be uploaded to the server.", htmlInfoName));
    4749
    4850                } else {
     
    5153                    }
    5254                    if (info.getLayer().requiresUploadToServer()) {
    53                         sb.append(tr("Layer ''{0}'' has modifications which are discouraged to be uploaded.", info.getName()));
     55                        sb.append(tr("Layer ''{0}'' has modifications which are discouraged to be uploaded.", htmlInfoName));
    5456                    } else {
    55                         sb.append(tr("Layer ''{0}'' has no modifications to be uploaded.", info.getName()));
     57                        sb.append(tr("Layer ''{0}'' has no modifications to be uploaded.", htmlInfoName));
    5658                    }
    5759                }
     
    6163                    panel.add(needsSave, defaultCellStyle);
    6264                    sb.append(tr("Layer ''{0}'' has modifications which should be saved to its associated file ''{1}''.",
    63                             info.getName(), info.getFile().toString()));
     65                            htmlInfoName, info.getFile().toString()));
    6466                } else {
    6567                    if (info.isSavable()) {
    6668                        panel.add(pnlEmpty, defaultCellStyle);
    6769                    }
    68                     sb.append(tr("Layer ''{0}'' has no modifications to be saved.", info.getName()));
     70                    sb.append(tr("Layer ''{0}'' has no modifications to be saved.", htmlInfoName));
    6971                }
    7072            }
Note: See TracChangeset for help on using the changeset viewer.