Skip to content

Commit

Permalink
Merge pull request #1282 from hanshuaikang/feature/develop_by_han
Browse files Browse the repository at this point in the history
fix: 自定义CustomBKRepoStorage, 修复制品库文件上传失败的问题
  • Loading branch information
hanshuaikang authored Feb 28, 2024
2 parents dcb494b + e2b5e99 commit 29ab093
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
17 changes: 16 additions & 1 deletion adapter/utils/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,23 @@ class RepoStorage(Storage):
def storage(self):
from bkstorages.backends.bkrepo import BKRepoStorage

class CustomBKRepoStorage(BKRepoStorage):
def save(self, name, content, max_length=None):
"""
去除validate_file_name(name, allow_relative_path=True) 检查,保证content的可用性
"""
if name is None:
name = content.name

if not hasattr(content, "chunks"):
content = File(content, name)

name = self.get_available_name(name, max_length=max_length)
name = self._save(name, content)
return name

if self._storage is None:
self._storage = BKRepoStorage()
self._storage = CustomBKRepoStorage()
return self._storage

def save(self, name, content, max_length=None):
Expand Down
2 changes: 1 addition & 1 deletion app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ author: 蓝鲸智云
category: 办公应用
introduction: 流程服务是蓝鲸推出的轻量级ITSM,通过可自定义设计的流程模块,覆盖IT服务中的不同管理活动或应用场景。帮助企业用户规范内部管理流程,提升沟通及管理效率。
introduction_en: bk_itsm is a lightweight ITSM created by Blueking. It covers different application scenarios in IT services through customizable workflows and help enterprise users to implement standardize IT workflow, improve communication and management efficiency.
version: 2.6.11-alpha.1
version: 2.6.11-alpha.2
language: python
is_use_celery: True
is_use_celery_with_gevent: False
Expand Down
2 changes: 1 addition & 1 deletion app_desc.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
spec_version: 2
app_version: "2.6.11-alpha.1"
app_version: "2.6.11-alpha.2"
app:
region: default
bk_app_code: bk_itsm
Expand Down

0 comments on commit 29ab093

Please sign in to comment.