Fix parsing and wrapping tuple values in Args setting inside Pleroma.Upload.Filter.Mogrify
This commit is contained in:
parent
659adbe6d7
commit
8e1825ae1a
2 changed files with 6 additions and 16 deletions
|
@ -50,12 +50,7 @@ export const parseNonTuples = (key, value) => {
|
|||
return updated
|
||||
}
|
||||
if (key === ':args') {
|
||||
if (typeof value === 'string') {
|
||||
return [value]
|
||||
}
|
||||
const index = value.findIndex(el => typeof el === 'object' && el.tuple.includes('implode'))
|
||||
const updated = value.map((el, i) => i === index ? 'implode' : el)
|
||||
return updated
|
||||
return typeof value === 'string' ? [value] : value
|
||||
}
|
||||
return value
|
||||
}
|
||||
|
@ -259,13 +254,6 @@ const wrapValues = (settings, currentState) => {
|
|||
} else if (setting === ':ip') {
|
||||
const ip = value.split('.').map(s => parseInt(s, 10))
|
||||
return { 'tuple': [setting, { 'tuple': ip }] }
|
||||
} else if (setting === ':args') {
|
||||
const index = value.findIndex(el => el === 'implode')
|
||||
const updatedArray = value.slice()
|
||||
if (index !== -1) {
|
||||
updatedArray[index] = { 'tuple': ['implode', '1'] }
|
||||
}
|
||||
return { 'tuple': [setting, updatedArray] }
|
||||
} else {
|
||||
return { 'tuple': [setting, value] }
|
||||
}
|
||||
|
|
|
@ -20,9 +20,11 @@
|
|||
allow-create
|
||||
class="input"
|
||||
@change="updateSetting($event, settingGroup.group, settingGroup.key, setting.key, setting.type)">
|
||||
<el-option value="strip" label="strip"/>
|
||||
<el-option value="auto-orient" label="auto-orient"/>
|
||||
<el-option value="implode" label="implode"/>
|
||||
<el-option value="strip"/>
|
||||
<el-option value="auto-orient"/>
|
||||
<!-- eslint-disable -->
|
||||
<el-option value='{"implode", "1"}'/>
|
||||
<!-- eslint-enable -->
|
||||
</el-select>
|
||||
</div>
|
||||
</template>
|
||||
|
|
Loading…
Reference in a new issue