Show More
@@ -209,3 +209,16 b' class LocalFileStorage(object):' | |||||
209 | filename = os.path.join(directory, filename) |
|
209 | filename = os.path.join(directory, filename) | |
210 |
|
210 | |||
211 | return filename, metadata |
|
211 | return filename, metadata | |
|
212 | ||||
|
213 | def get_metadata(self, filename): | |||
|
214 | """ | |||
|
215 | Reads JSON stored metadata for a file | |||
|
216 | ||||
|
217 | :param filename: | |||
|
218 | :return: | |||
|
219 | """ | |||
|
220 | filename = self.store_path(filename) | |||
|
221 | filename_meta = filename + '.meta' | |||
|
222 | ||||
|
223 | with open(filename_meta, "rb") as source_meta: | |||
|
224 | return json.loads(source_meta.read()) |
@@ -68,7 +68,7 b' class FileStoreView(BaseAppView):' | |||||
68 | 'user_id': self._rhodecode_user.user_id, |
|
68 | 'user_id': self._rhodecode_user.user_id, | |
69 | 'ip': self._rhodecode_user.ip_addr}} |
|
69 | 'ip': self._rhodecode_user.ip_addr}} | |
70 | try: |
|
70 | try: | |
71 |
store_ |
|
71 | store_uid, metadata = self.storage.save_file( | |
72 | file_obj.file, filename, extra_metadata=metadata) |
|
72 | file_obj.file, filename, extra_metadata=metadata) | |
73 | except FileNotAllowedException: |
|
73 | except FileNotAllowedException: | |
74 | return {'store_fid': None, |
|
74 | return {'store_fid': None, | |
@@ -82,7 +82,7 b' class FileStoreView(BaseAppView):' | |||||
82 |
|
82 | |||
83 | try: |
|
83 | try: | |
84 | entry = FileStore.create( |
|
84 | entry = FileStore.create( | |
85 |
file_uid=store_ |
|
85 | file_uid=store_uid, filename=metadata["filename"], | |
86 | file_hash=metadata["sha256"], file_size=metadata["size"], |
|
86 | file_hash=metadata["sha256"], file_size=metadata["size"], | |
87 | file_description='upload attachment', |
|
87 | file_description='upload attachment', | |
88 | check_acl=False, user_id=self._rhodecode_user.user_id |
|
88 | check_acl=False, user_id=self._rhodecode_user.user_id | |
@@ -96,8 +96,8 b' class FileStoreView(BaseAppView):' | |||||
96 | 'access_path': None, |
|
96 | 'access_path': None, | |
97 | 'error': 'File {} failed to store in DB.'.format(filename)} |
|
97 | 'error': 'File {} failed to store in DB.'.format(filename)} | |
98 |
|
98 | |||
99 |
return {'store_fid': store_ |
|
99 | return {'store_fid': store_uid, | |
100 |
'access_path': h.route_path('download_file', fid=store_ |
|
100 | 'access_path': h.route_path('download_file', fid=store_uid)} | |
101 |
|
101 | |||
102 | @view_config(route_name='download_file') |
|
102 | @view_config(route_name='download_file') | |
103 | def download_file(self): |
|
103 | def download_file(self): |
@@ -92,6 +92,9 b' ACTIONS_V1 = {' | |||||
92 | 'repo.commit.comment.delete': {'data': {}}, |
|
92 | 'repo.commit.comment.delete': {'data': {}}, | |
93 | 'repo.commit.vote': '', |
|
93 | 'repo.commit.vote': '', | |
94 |
|
94 | |||
|
95 | 'repo.artifact.add': '', | |||
|
96 | 'repo.artifact.delete': '', | |||
|
97 | ||||
95 | 'repo_group.create': {'data': {}}, |
|
98 | 'repo_group.create': {'data': {}}, | |
96 | 'repo_group.edit': {'old_data': {}}, |
|
99 | 'repo_group.edit': {'old_data': {}}, | |
97 | 'repo_group.edit.permissions': {}, |
|
100 | 'repo_group.edit.permissions': {}, |
General Comments 0
You need to be logged in to leave comments.
Login now