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
|
commitTitlePlaceHolder: string
|
||||||
oldResourcePath?: string
|
oldResourcePath?: string
|
||||||
payload?: string
|
payload?: string
|
||||||
|
sha?: string
|
||||||
onSuccess: (data: RepoCommitFilesResponse, newBranch?: string) => void
|
onSuccess: (data: RepoCommitFilesResponse, newBranch?: string) => void
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,6 +64,7 @@ export const CommitModalButton: React.FC<CommitModalButtonProps> = ({
|
||||||
commitTitlePlaceHolder,
|
commitTitlePlaceHolder,
|
||||||
oldResourcePath,
|
oldResourcePath,
|
||||||
payload = '',
|
payload = '',
|
||||||
|
sha,
|
||||||
onSuccess,
|
onSuccess,
|
||||||
...props
|
...props
|
||||||
}) => {
|
}) => {
|
||||||
|
@ -82,7 +84,8 @@ export const CommitModalButton: React.FC<CommitModalButtonProps> = ({
|
||||||
{
|
{
|
||||||
action: commitAction,
|
action: commitAction,
|
||||||
path: oldResourcePath || resourcePath,
|
path: oldResourcePath || resourcePath,
|
||||||
payload: `${oldResourcePath ? `file://${resourcePath}\n` : ''}${payload}`
|
payload: `${oldResourcePath ? `file://${resourcePath}\n` : ''}${payload}`,
|
||||||
|
sha
|
||||||
// encoding: 'base64',
|
// encoding: 'base64',
|
||||||
// payload: window.btoa(payload || '')
|
// payload: window.btoa(payload || '')
|
||||||
}
|
}
|
||||||
|
|
|
@ -179,9 +179,10 @@ function Editor({
|
||||||
oldResourcePath={commitAction === GitCommitAction.MOVE ? resourcePath : undefined}
|
oldResourcePath={commitAction === GitCommitAction.MOVE ? resourcePath : undefined}
|
||||||
resourcePath={fileResourcePath}
|
resourcePath={fileResourcePath}
|
||||||
payload={content}
|
payload={content}
|
||||||
|
sha={resourceContent.sha}
|
||||||
onSuccess={(_data, newBranch) => {
|
onSuccess={(_data, newBranch) => {
|
||||||
history.replace(
|
history.replace(
|
||||||
routes.toCODERepositoryFileEdit({
|
routes.toCODERepository({
|
||||||
repoPath: repoMetadata.path as string,
|
repoPath: repoMetadata.path as string,
|
||||||
resourcePath: fileResourcePath,
|
resourcePath: fileResourcePath,
|
||||||
gitRef: newBranch || gitRef
|
gitRef: newBranch || gitRef
|
||||||
|
|
Loading…
Reference in New Issue