mirror of
https://github.com/ansible/awx.git
synced 2026-02-01 01:28:09 -03:30
Merge pull request #9713 from jakemcdermott/fix-9701
Don't append a slash to file paths for #9701 Reviewed-by: Jake McDermott <yo@jakemcdermott.me> Reviewed-by: Shane McDonald <me@shanemcd.com> Reviewed-by: Alex Corey <Alex.swansboro@gmail.com>
This commit is contained in:
@@ -122,20 +122,14 @@ const SCMSubForm = ({ autoPopulateProject, i18n }) => {
|
|||||||
onSelect={(event, value) => {
|
onSelect={(event, value) => {
|
||||||
setIsOpen(false);
|
setIsOpen(false);
|
||||||
value = value.trim();
|
value = value.trim();
|
||||||
if (!value.endsWith('/')) {
|
|
||||||
value += '/';
|
|
||||||
}
|
|
||||||
sourcePathHelpers.setValue(value);
|
sourcePathHelpers.setValue(value);
|
||||||
}}
|
}}
|
||||||
aria-label={i18n._(t`Select source path`)}
|
aria-label={i18n._(t`Select source path`)}
|
||||||
placeholder={i18n._(t`Select source path`)}
|
placeholder={i18n._(t`Select source path`)}
|
||||||
|
createText={i18n._(t`Set source path to`)}
|
||||||
isCreatable
|
isCreatable
|
||||||
onCreateOption={value => {
|
onCreateOption={value => {
|
||||||
value.trim();
|
value.trim();
|
||||||
|
|
||||||
if (!value.endsWith('/')) {
|
|
||||||
value += '/';
|
|
||||||
}
|
|
||||||
setSourcePath([...sourcePath, value]);
|
setSourcePath([...sourcePath, value]);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ describe('<SCMSubForm />', () => {
|
|||||||
});
|
});
|
||||||
wrapper.update();
|
wrapper.update();
|
||||||
expect(wrapper.find('Select#source_path').prop('selections')).toEqual(
|
expect(wrapper.find('Select#source_path').prop('selections')).toEqual(
|
||||||
'bar/'
|
'bar'
|
||||||
);
|
);
|
||||||
|
|
||||||
await act(async () => {
|
await act(async () => {
|
||||||
@@ -138,7 +138,7 @@ describe('<SCMSubForm />', () => {
|
|||||||
customWrapper.find('Select').invoke('onSelect')({}, 'newPath');
|
customWrapper.find('Select').invoke('onSelect')({}, 'newPath');
|
||||||
});
|
});
|
||||||
customWrapper.update();
|
customWrapper.update();
|
||||||
expect(customWrapper.find('Select').prop('selections')).toBe('newPath/');
|
expect(customWrapper.find('Select').prop('selections')).toBe('newPath');
|
||||||
});
|
});
|
||||||
test('Update on project update should be disabled', async () => {
|
test('Update on project update should be disabled', async () => {
|
||||||
const customInitialValues = {
|
const customInitialValues = {
|
||||||
|
|||||||
Reference in New Issue
Block a user