(ctx context.Context, req *getFilesRequest)
| 748 | } |
| 749 | |
| 750 | func (s *server) getFiles(ctx context.Context, req *getFilesRequest) (*getFilesResponse, error) { |
| 751 | userID, err := s.getUserID(ctx) |
| 752 | if err != nil { |
| 753 | return nil, httperr.Unauthorized("failed to load user ID: %w", err) |
| 754 | } |
| 755 | |
| 756 | gID := db.GraphID(req.GraphUUID) |
| 757 | if _, err := s.db.Graph(ctx, gID); db.IsNotExists(err) { |
| 758 | return nil, httperr.NotFound("graph %q wasn't found", req.GraphUUID) |
| 759 | } else if err != nil { |
| 760 | return nil, httperr.Internal("failed to load graph: %w", err) |
| 761 | } |
| 762 | |
| 763 | out := make(map[string]string) |
| 764 | // TODO: Consider checking to see if these are valid, though there's no harm in |
| 765 | // signing a URL for a non-existent blob. |
| 766 | for _, id := range req.Files { |
| 767 | key := path.Join(string(userID), string(gID), id) |
| 768 | signed, err := s.blob.SignedDownloadURL(ctx, key, 5*time.Minute) |
| 769 | if err != nil { |
| 770 | return nil, httperr.Internal("failed to sign URL: %w", err) |
| 771 | } |
| 772 | out[id] = signed |
| 773 | } |
| 774 | |
| 775 | return &getFilesResponse{ |
| 776 | PresignedFileURLs: out, |
| 777 | }, nil |
| 778 | } |
| 779 | |
| 780 | type getTempCredentialRequest struct{} |
| 781 |
nothing calls this directly
no test coverage detected