Skip to content

relative_path In upload_file #118

Open

Description

@red4dj

Why is relative_path a parameter in upload_local_file() and upload_bytes_file()? Regardless of its definition it is always overwritten.
The parameter should either be removed or its intended functionality should be fixed a.la. wrapping the if file_type statement in an if relative_path is not None:.

Reference:

def upload_local_file(self, file_path, name=None, relative_path=None, file_type='file', replace=False):
    ...
    if file_type == 'image':
        relative_path = upload_link_dict['img_relative_path']
    else:
        relative_path = upload_link_dict['file_relative_path']
def upload_bytes_file(self, name, content: bytes, relative_path=None, file_type='file', replace=False):
    ...
    if file_type == 'image':
        relative_path = upload_link_dict['img_relative_path']
    else:
        relative_path = upload_link_dict['file_relative_path']

Activity

  1. simonhammes commented on Oct 6, 2026

    @simonhammes
    Collaborator

    This was changed in PR #104.

    I agree that the parameter is currently unused, but removing it would be a backwards-incompatible change.

  2. red4dj commented on Oct 6, 2026

    @red4dj
    Author

    Understood, could this be resolved by adding if relative_path is None:? This would return functionality to relative_path while not affecting current functionality or making any breaking changes. This also shouldn't affect the usage of file_type because each function starts with an if file_type not in ['image', 'file'] exception.

    if relative_path is None:
      if file_type == 'image':
          relative_path = upload_link_dict['img_relative_path']
      else:
          relative_path = upload_link_dict['file_relative_path']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions