Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

git-bob

Package Overview
Dependencies
Maintainers
1
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

git-bob - npm Package Compare versions

Comparing version
0.27.0
to
0.27.1
+1
-1
PKG-INFO
Metadata-Version: 2.4
Name: git-bob
Version: 0.27.0
Version: 0.27.1
Summary: git-bob uses AI to solve Github-issues. It runs inside the Github CI, no need to install anything on your computer.

@@ -5,0 +5,0 @@ Home-page: https://github.com/haesleinhuepf/git-bob

Metadata-Version: 2.4
Name: git-bob
Version: 0.27.0
Version: 0.27.1
Summary: git-bob uses AI to solve Github-issues. It runs inside the Github CI, no need to install anything on your computer.

@@ -5,0 +5,0 @@ Home-page: https://github.com/haesleinhuepf/git-bob

@@ -1,2 +0,2 @@

__version__ = "0.27.0"
__version__ = "0.27.1"

@@ -3,0 +3,0 @@ __all__ = (

# This file contains utility functions using the github API via github-python:
# https://github.com/PyGithub/PyGithub (licensed LGPL3)
#
#
import os

@@ -325,3 +325,3 @@ from functools import lru_cache

# Get the file content
file_content = get_file_in_repository (repository, branch_name, file_path).decoded_content.decode()
file_content = decode_file(get_file_in_repository(repository, branch_name, file_path))

@@ -755,3 +755,3 @@ # store the content

# Create a new file with the old content at the new path
repo.create_file(new_file_path, commit_message, file.decoded_content.decode(), branch=branch_name)
repo.create_file(new_file_path, commit_message, decode_file(file), branch=branch_name)

@@ -767,5 +767,58 @@ # Delete the old file

def decode_file(file):
return file.decoded_content.decode()
"""
Decode a GitHub ContentFile to a text string.
This function primarily uses PyGithub's decoded_content, which expects base64-encoded
content. For cases where GitHub returns encoding 'none' (e.g., for large files),
it falls back to downloading the raw content via download_url or the Git blob API.
Parameters
----------
file : github.ContentFile.ContentFile
The file object retrieved from the GitHub API.
Returns
-------
str
The decoded text content of the file.
Raises
------
AssertionError
If decoding fails and no fallback path is available.
UnicodeDecodeError
If the content is binary or cannot be decoded as text.
"""
# Normal path for base64-encoded contents
try:
return file.decoded_content.decode()
except AssertionError:
# Fallback for "encoding: none" (e.g., large files)
import requests
import base64
token = os.getenv("GITHUB_API_KEY")
headers = {"Authorization": f"token {token}"} if token else {}
# 1) Try raw download URL
download_url = getattr(file, "download_url", None)
if download_url:
r = requests.get(download_url, headers=headers)
r.raise_for_status()
return r.content.decode()
# 2) Fallback to Git blob API (always base64)
git_url = getattr(file, "git_url", None)
if git_url:
r = requests.get(git_url, headers=headers)
r.raise_for_status()
data = r.json()
if data.get("encoding") == "base64" and "content" in data:
content = base64.b64decode(data["content"])
return content.decode()
# If neither path worked, re-raise for caller to handle
raise
def delete_file_from_repository(repository, branch_name, file_path, commit_message="Delete file"):

@@ -828,3 +881,3 @@ """

file = get_file_in_repository(repository, branch_name, src_file_path)
file_content = file.decoded_content.decode()
file_content = decode_file(file)

@@ -936,2 +989,1 @@ # Create a new file with the old content at the new path

issue_obj.edit(state="closed")