generated from metakgp/README.md
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #93 from metakgp/approve_paper
Admin DashBoard Endpoint: Approve Paper
- Loading branch information
Showing
6 changed files
with
148 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package utils | ||
|
||
import ( | ||
"fmt" | ||
"io" | ||
"os" | ||
"strings" | ||
) | ||
|
||
func CopyFile(srcPath, destPath string) error { | ||
inputFile, err := os.Open(srcPath) | ||
if err != nil { | ||
return fmt.Errorf("couldn't open source file: %v", err) | ||
} | ||
defer inputFile.Close() | ||
|
||
outputFile, err := os.Create(destPath) | ||
if err != nil { | ||
return fmt.Errorf("couldn't open dest file: %v", err) | ||
} | ||
defer outputFile.Close() | ||
|
||
_, err = io.Copy(outputFile, inputFile) | ||
if err != nil { | ||
return fmt.Errorf("couldn't copy to dest from source: %v", err) | ||
} | ||
|
||
inputFile.Close() | ||
return nil | ||
} | ||
|
||
func DeleteFile(path string) error { | ||
err := os.Remove(path) | ||
if err != nil { | ||
return err | ||
} | ||
return nil | ||
} | ||
|
||
func SanitizeFileLink(path string) string { | ||
result := strings.Replace(path, " ", "_", -1) | ||
result = strings.TrimSpace(result) | ||
return result | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters