Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Sharkey
Manage
Activity
Members
Labels
Plan
Issues
339
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
24
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TransFem.org
Sharkey
Commits
ca4f0265
Unverified
Commit
ca4f0265
authored
4 years ago
by
MeiMei
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
DB上で壊れたドライブファイルを無視するように (#7345)
parent
7d02b360
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/models/repositories/drive-file.ts
+16
-14
16 additions, 14 deletions
src/models/repositories/drive-file.ts
with
16 additions
and
14 deletions
src/models/repositories/drive-file.ts
+
16
−
14
View file @
ca4f0265
...
...
@@ -12,6 +12,12 @@ import { fetchMeta } from '../../misc/fetch-meta';
export
type
PackedDriveFile
=
SchemaType
<
typeof
packedDriveFileSchema
>
;
type
PackOptions
=
{
detail
?:
boolean
,
self
?:
boolean
,
withUser
?:
boolean
,
};
@
EntityRepository
(
DriveFile
)
export
class
DriveFileRepository
extends
Repository
<
DriveFile
>
{
public
validateFileName
(
name
:
string
):
boolean
{
...
...
@@ -89,20 +95,19 @@ export class DriveFileRepository extends Repository<DriveFile> {
return
parseInt
(
sum
,
10
)
||
0
;
}
public
async
pack
(
src
:
DriveFile
[
'
id
'
],
options
?:
PackOptions
):
Promise
<
PackedDriveFile
|
null
>
;
public
async
pack
(
src
:
DriveFile
,
options
?:
PackOptions
):
Promise
<
PackedDriveFile
>
;
public
async
pack
(
src
:
DriveFile
[
'
id
'
]
|
DriveFile
,
options
?:
{
detail
?:
boolean
,
self
?:
boolean
,
withUser
?:
boolean
,
}
):
Promise
<
PackedDriveFile
>
{
options
?:
PackOptions
):
Promise
<
PackedDriveFile
|
null
>
{
const
opts
=
Object
.
assign
({
detail
:
false
,
self
:
false
},
options
);
const
file
=
typeof
src
===
'
object
'
?
src
:
await
this
.
findOneOrFail
(
src
);
const
file
=
typeof
src
===
'
object
'
?
src
:
await
this
.
findOne
(
src
);
if
(
file
==
null
)
return
null
;
const
meta
=
await
fetchMeta
();
...
...
@@ -128,15 +133,12 @@ export class DriveFileRepository extends Repository<DriveFile> {
});
}
public
packMany
(
public
async
packMany
(
files
:
any
[],
options
?:
{
detail
?:
boolean
self
?:
boolean
,
withUser
?:
boolean
,
}
options
?:
PackOptions
)
{
return
Promise
.
all
(
files
.
map
(
f
=>
this
.
pack
(
f
,
options
)));
const
items
=
await
Promise
.
all
(
files
.
map
(
f
=>
this
.
pack
(
f
,
options
)));
return
items
.
filter
(
x
=>
x
!=
null
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment