mirror of
https://github.com/gotenberg/gotenberg.git
synced 2026-08-16 04:12:16 +01:00
feat(exiftool): refactor read write metadata
This commit is contained in:
@@ -78,12 +78,12 @@ func (engine *QPdf) Convert(ctx context.Context, logger *zap.Logger, formats got
|
||||
}
|
||||
|
||||
// ReadMetadata is not available in this implementation.
|
||||
func (engine *QPdf) ReadMetadata(ctx context.Context, logger *zap.Logger, inputPaths string, metadata map[string]interface{}) error {
|
||||
return fmt.Errorf("read PDF metadata with QPDF: %w", gotenberg.ErrPdfEngineMethodNotSupported)
|
||||
func (engine *QPdf) ReadMetadata(ctx context.Context, logger *zap.Logger, inputPath string) (map[string]interface{}, error) {
|
||||
return nil, fmt.Errorf("read PDF metadata with QPDF: %w", gotenberg.ErrPdfEngineMethodNotSupported)
|
||||
}
|
||||
|
||||
// WriteMetadata is not available in this implementation.
|
||||
func (engine *QPdf) WriteMetadata(ctx context.Context, logger *zap.Logger, inputPaths string, newMetadata map[string]interface{}) error {
|
||||
func (engine *QPdf) WriteMetadata(ctx context.Context, logger *zap.Logger, metadata map[string]interface{}, inputPath string) error {
|
||||
return fmt.Errorf("write PDF metadata with QPDF: %w", gotenberg.ErrPdfEngineMethodNotSupported)
|
||||
}
|
||||
|
||||
|
||||
@@ -151,7 +151,7 @@ func TestQPdf_Convert(t *testing.T) {
|
||||
|
||||
func TestLibreOfficePdfEngine_ReadMetadata(t *testing.T) {
|
||||
engine := new(QPdf)
|
||||
err := engine.ReadMetadata(context.Background(), zap.NewNop(), "", nil)
|
||||
_, err := engine.ReadMetadata(context.Background(), zap.NewNop(), "")
|
||||
|
||||
if !errors.Is(err, gotenberg.ErrPdfEngineMethodNotSupported) {
|
||||
t.Errorf("expected error %v, but got: %v", gotenberg.ErrPdfEngineMethodNotSupported, err)
|
||||
@@ -160,7 +160,7 @@ func TestLibreOfficePdfEngine_ReadMetadata(t *testing.T) {
|
||||
|
||||
func TestLibreOfficePdfEngine_WriteMetadata(t *testing.T) {
|
||||
engine := new(QPdf)
|
||||
err := engine.WriteMetadata(context.Background(), zap.NewNop(), "", nil)
|
||||
err := engine.WriteMetadata(context.Background(), zap.NewNop(), nil, "")
|
||||
|
||||
if !errors.Is(err, gotenberg.ErrPdfEngineMethodNotSupported) {
|
||||
t.Errorf("expected error %v, but got: %v", gotenberg.ErrPdfEngineMethodNotSupported, err)
|
||||
|
||||
Reference in New Issue
Block a user