PutFile puts file into published storage at specified path.
(path string, sourceFilename string)
| 112 | |
| 113 | // PutFile puts file into published storage at specified path. |
| 114 | func (g *PublishedStorage) PutFile(path string, sourceFilename string) error { |
| 115 | source, err := os.Open(sourceFilename) |
| 116 | if err != nil { |
| 117 | return err |
| 118 | } |
| 119 | defer func() { _ = source.Close() }() |
| 120 | |
| 121 | if g.debug { |
| 122 | log.Debug().Msgf("GCS: PutFile '%s'", path) |
| 123 | } |
| 124 | |
| 125 | err = g.putFile(path, source, "") |
| 126 | if err != nil { |
| 127 | return errors.Wrap(err, fmt.Sprintf("error uploading %s to %s", sourceFilename, g)) |
| 128 | } |
| 129 | |
| 130 | return nil |
| 131 | } |
| 132 | |
| 133 | func (g *PublishedStorage) applyACL(obj *storage.ObjectHandle) error { |
| 134 | switch g.acl { |