generated from VLADIMIR/template
clear
This commit is contained in:
@@ -28,6 +28,9 @@ import (
|
||||
"google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// stringTools — транслитерация имён файлов для HTTP-заголовков.
|
||||
var stringTools = string_tools.NewStringTools()
|
||||
|
||||
type server struct {
|
||||
proto.UnsafeEveningDetectiveServerServer
|
||||
|
||||
@@ -603,7 +606,7 @@ func (s *server) DownloadScenarioArchive(ctx context.Context, req *proto.Downloa
|
||||
|
||||
// Имя файла транслитерируется (заголовки HTTP — только ASCII) и
|
||||
// санитайзится от header injection; заголовок пробрасывается gateway.
|
||||
transliterated := sanitizeFilename(string_tools.Transliterate(name))
|
||||
transliterated := sanitizeFilename(stringTools.Transliterate(name))
|
||||
if transliterated == "" {
|
||||
transliterated = "scenario"
|
||||
}
|
||||
|
||||
@@ -9,6 +9,9 @@ import (
|
||||
"google.golang.org/protobuf/types/known/timestamppb"
|
||||
)
|
||||
|
||||
// textFormatter — форматирование текста при конвертации входящих данных.
|
||||
var textFormatter = formatter_utils.NewFormatter()
|
||||
|
||||
func mapScenarios(o []*scenarios_service.Scenario) []*proto.Scenario {
|
||||
res := make([]*proto.Scenario, 0, len(o))
|
||||
for _, item := range o {
|
||||
@@ -117,8 +120,8 @@ func mapKey(o *storytelling.Key) *proto.Key {
|
||||
func convertPlace(o *proto.Place) *storytelling.Place {
|
||||
return &storytelling.Place{
|
||||
Code: o.Code,
|
||||
Name: formatter_utils.FormatString(o.Name),
|
||||
Text: formatter_utils.FormatText(o.Text),
|
||||
Name: textFormatter.FormatString(o.Name),
|
||||
Text: textFormatter.FormatText(o.Text),
|
||||
Image: o.Image,
|
||||
Hidden: o.Hidden,
|
||||
Applications: convertApplications(o.Applications),
|
||||
@@ -153,7 +156,7 @@ func convertKeys(o []*proto.Key) []*storytelling.Key {
|
||||
|
||||
func convertApplication(o *proto.Application) *storytelling.Application {
|
||||
return &storytelling.Application{
|
||||
Name: formatter_utils.FormatString(o.Name),
|
||||
Name: textFormatter.FormatString(o.Name),
|
||||
Image: o.Image,
|
||||
}
|
||||
}
|
||||
@@ -161,13 +164,13 @@ func convertApplication(o *proto.Application) *storytelling.Application {
|
||||
func convertDoor(o *proto.Door) *storytelling.Door {
|
||||
return &storytelling.Door{
|
||||
Code: o.Code,
|
||||
Name: formatter_utils.FormatString(o.Name),
|
||||
Name: textFormatter.FormatString(o.Name),
|
||||
Keys: convertKeys(o.Keys),
|
||||
}
|
||||
}
|
||||
|
||||
func convertKey(o *proto.Key) *storytelling.Key {
|
||||
return &storytelling.Key{
|
||||
Name: formatter_utils.FormatString(o.Name),
|
||||
Name: textFormatter.FormatString(o.Name),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user