Skip to content
This repository has been archived by the owner on Jun 9, 2021. It is now read-only.

Commit

Permalink
Avoiding admin page to crash if entering quote as value of a field #73
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasbjerre committed Oct 10, 2015
1 parent 6dbb299 commit 0e59f01
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

Changelog of Pull Request Notifier for Stash.

## 1.31
* Bugfix: Avoiding admin page to crash if entering quote as value of a field.

## 1.30
* Adding "Triggers do not apply to" option with values DECLINED and MERGED.
* Changing wording of trigger conditions in admin GUI.
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/se/bjurr/prnfs/settings/SettingsStorage.java
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,10 @@ private static AdminFormValues injectConfigurationName(AdminFormValues adminForm
if (nameMapOpt.isPresent()) {
return adminFormValues;
}
adminFormValues.add(ImmutableMap.<String, String> builder().put(NAME, name.name()).put(VALUE, DEFAULT_NAME).build());
adminFormValues.add(ImmutableMap.<String, String> builder()//
.put(NAME, name.name())//
.put(VALUE, DEFAULT_NAME)//
.build());
return adminFormValues;
}

Expand Down
7 changes: 4 additions & 3 deletions src/main/resources/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,15 @@
var $template = $(".prnfs-template-"+formType).clone();

$.each(config, function(fieldIndex,field_map) {
var safe_value = field_map.value.replace(/[^a-zA-Z]/g,'');
$('.variable[data-variable="'+field_map.name+'"]', $template).html(field_map.value);
$('input[type="text"][name="'+field_map.name+'"]', $template).attr('value', field_map.value);
$('input[type="password"][name="'+field_map.name+'"]', $template).attr('value', field_map.value);
$('textarea[name="'+field_map.name+'"]', $template).text(field_map.value);
$('input[type="hidden"][name="'+field_map.name+'"]', $template).attr('value', field_map.value);
$('input[type="checkbox"][name="'+field_map.name+'"][value="'+field_map.value+'"]', $template).attr('checked','checked');
$('input[type="radio"][name="'+field_map.name+'"][value="'+field_map.value+'"]', $template).attr('checked','checked');
$('.visibleif.'+field_map.name+'_'+field_map.value.replace(/[^a-zA-Z]/g,''), $template).show();
$('input[type="checkbox"][name="'+field_map.name+'"][value="'+safe_value+'"]', $template).attr('checked','checked');
$('input[type="radio"][name="'+field_map.name+'"][value="'+safe_value+'"]', $template).attr('checked','checked');
$('.visibleif.'+field_map.name+'_'+safe_value, $template).show();
});

var header_names = [];
Expand Down

0 comments on commit 0e59f01

Please sign in to comment.