mirror of https://github.com/harness/drone.git
Fix 500 exception when editing a file (#96)
parent
505d72049b
commit
a90fc1c59e
|
@ -52,6 +52,7 @@ interface CommitModalButtonProps extends Omit<ButtonProps, 'onClick' | 'onSubmit
|
|||
commitTitlePlaceHolder: string
|
||||
oldResourcePath?: string
|
||||
payload?: string
|
||||
sha?: string
|
||||
onSuccess: (data: RepoCommitFilesResponse, newBranch?: string) => void
|
||||
}
|
||||
|
||||
|
@ -63,6 +64,7 @@ export const CommitModalButton: React.FC<CommitModalButtonProps> = ({
|
|||
commitTitlePlaceHolder,
|
||||
oldResourcePath,
|
||||
payload = '',
|
||||
sha,
|
||||
onSuccess,
|
||||
...props
|
||||
}) => {
|
||||
|
@ -82,7 +84,8 @@ export const CommitModalButton: React.FC<CommitModalButtonProps> = ({
|
|||
{
|
||||
action: commitAction,
|
||||
path: oldResourcePath || resourcePath,
|
||||
payload: `${oldResourcePath ? `file://${resourcePath}\n` : ''}${payload}`
|
||||
payload: `${oldResourcePath ? `file://${resourcePath}\n` : ''}${payload}`,
|
||||
sha
|
||||
// encoding: 'base64',
|
||||
// payload: window.btoa(payload || '')
|
||||
}
|
||||
|
|
|
@ -179,9 +179,10 @@ function Editor({
|
|||
oldResourcePath={commitAction === GitCommitAction.MOVE ? resourcePath : undefined}
|
||||
resourcePath={fileResourcePath}
|
||||
payload={content}
|
||||
sha={resourceContent.sha}
|
||||
onSuccess={(_data, newBranch) => {
|
||||
history.replace(
|
||||
routes.toCODERepositoryFileEdit({
|
||||
routes.toCODERepository({
|
||||
repoPath: repoMetadata.path as string,
|
||||
resourcePath: fileResourcePath,
|
||||
gitRef: newBranch || gitRef
|
||||
|
|
Loading…
Reference in New Issue