mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2025-12-30 17:00:57 -06:00
remove deprecated use of ioutil (#5205)
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de> Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
This commit is contained in:
committed by
GitHub
parent
46cb910637
commit
53d15d329e
@@ -2,7 +2,6 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@@ -40,7 +39,7 @@ type templateData struct {
|
||||
|
||||
func main() {
|
||||
fmt.Println("Generating adoc documentation for environment variables:")
|
||||
content, err := ioutil.ReadFile("../../docs/templates/ADOC.tmpl")
|
||||
content, err := os.ReadFile("../../docs/templates/ADOC.tmpl")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"os/exec"
|
||||
@@ -41,7 +40,7 @@ func main() {
|
||||
}
|
||||
|
||||
func GenerateIntermediateCode(templatePath string, intermediateCodePath string, paths []string) {
|
||||
content, err := ioutil.ReadFile(templatePath)
|
||||
content, err := os.ReadFile(templatePath)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package main
|
||||
import (
|
||||
"fmt"
|
||||
"html"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@@ -24,7 +23,7 @@ type ConfigField struct {
|
||||
|
||||
func main() {
|
||||
fmt.Println("Generating documentation for environment variables:")
|
||||
content, err := ioutil.ReadFile("../../docs/templates/CONFIGURATION.tmpl")
|
||||
content, err := os.ReadFile("../../docs/templates/CONFIGURATION.tmpl")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package ldap
|
||||
import (
|
||||
"crypto/x509"
|
||||
"errors"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -39,7 +38,7 @@ func WaitForCA(log log.Logger, insecure bool, caCert string) error {
|
||||
// Check if this actually is a CA cert. We need to retry here as well
|
||||
// as the file might exist already, but have no contents yet.
|
||||
certs := x509.NewCertPool()
|
||||
pemData, err := ioutil.ReadFile(caCert)
|
||||
pemData, err := os.ReadFile(caCert)
|
||||
if err != nil {
|
||||
log.Debug().Err(err).Str("LDAP CACert", caCert).Msg("Error reading CA")
|
||||
} else if !certs.AppendCertsFromPEM(pemData) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package log
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"io"
|
||||
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/sirupsen/logrus"
|
||||
@@ -28,7 +28,7 @@ type LogrusWrapper struct {
|
||||
// underlying zerolog via hooks.
|
||||
func LogrusWrap(zr zerolog.Logger) *logrus.Logger {
|
||||
lr := logrus.New()
|
||||
lr.SetOutput(ioutil.Discard)
|
||||
lr.SetOutput(io.Discard)
|
||||
lr.SetLevel(logrusLevel(zr.GetLevel()))
|
||||
lr.AddHook(&LogrusWrapper{
|
||||
zeroLog: &zr,
|
||||
@@ -52,7 +52,7 @@ func (h *LogrusWrapper) Fire(entry *logrus.Entry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
//Convert logrus fields to zerolog
|
||||
// Convert logrus fields to zerolog
|
||||
func zeroLogFields(fields logrus.Fields) map[string]interface{} {
|
||||
fm := make(map[string]interface{})
|
||||
for k, v := range fields {
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"crypto/tls"
|
||||
"crypto/x509"
|
||||
"errors"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"sync"
|
||||
|
||||
mgrpcc "github.com/go-micro/plugins/v4/client/grpc"
|
||||
@@ -68,7 +68,7 @@ func Configure(opts ...ClientOption) error {
|
||||
// Note: If caCert is empty we use the system's default set of trusted CAs
|
||||
if options.caCert != "" {
|
||||
certs := x509.NewCertPool()
|
||||
pemData, err := ioutil.ReadFile(options.caCert)
|
||||
pemData, err := os.ReadFile(options.caCert)
|
||||
if err != nil {
|
||||
outerr = err
|
||||
return
|
||||
|
||||
@@ -3,7 +3,6 @@ package init
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"path"
|
||||
@@ -359,7 +358,7 @@ func CreateConfig(insecure, forceOverwrite bool, configPath, adminPassword strin
|
||||
return fmt.Errorf("could not marshall config into yaml: %s", err)
|
||||
}
|
||||
targetPath := path.Join(configPath, configFilename)
|
||||
err = ioutil.WriteFile(targetPath, yamlOutput, 0600)
|
||||
err = os.WriteFile(targetPath, yamlOutput, 0600)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package revaconfig
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/log"
|
||||
@@ -111,7 +111,7 @@ func spacesProviders(cfg *config.Config, logger log.Logger) map[string]map[strin
|
||||
|
||||
// check if the rules have to be read from a json file
|
||||
if cfg.StorageRegistry.JSON != "" {
|
||||
data, err := ioutil.ReadFile(cfg.StorageRegistry.JSON)
|
||||
data, err := os.ReadFile(cfg.StorageRegistry.JSON)
|
||||
if err != nil {
|
||||
logger.Error().Err(err).Msg("Failed to read storage registry rules from JSON file: " + cfg.StorageRegistry.JSON)
|
||||
return nil
|
||||
|
||||
@@ -3,7 +3,7 @@ package svc_test
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"time"
|
||||
@@ -113,7 +113,7 @@ var _ = Describe("Driveitems", func() {
|
||||
r := httptest.NewRequest(http.MethodGet, "/graph/v1.0/me/drive/root/children", nil)
|
||||
svc.GetRootDriveChildren(rr, r)
|
||||
Expect(rr.Code).To(Equal(http.StatusOK))
|
||||
data, err := ioutil.ReadAll(rr.Body)
|
||||
data, err := io.ReadAll(rr.Body)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
res := itemsList{}
|
||||
|
||||
@@ -6,7 +6,6 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"time"
|
||||
@@ -825,7 +824,7 @@ var _ = Describe("Graph", func() {
|
||||
svc.GetSingleDrive(rr, r)
|
||||
Expect(rr.Code).To(Equal(http.StatusOK))
|
||||
|
||||
data, err := ioutil.ReadAll(rr.Body)
|
||||
data, err := io.ReadAll(rr.Body)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
drive := libregraph.Drive{}
|
||||
@@ -864,7 +863,7 @@ var _ = Describe("Graph", func() {
|
||||
svc.GetSingleDrive(rr, r)
|
||||
Expect(rr.Code).To(Equal(http.StatusOK))
|
||||
|
||||
data, err := ioutil.ReadAll(rr.Body)
|
||||
data, err := io.ReadAll(rr.Body)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
drive := libregraph.Drive{}
|
||||
@@ -925,7 +924,7 @@ var _ = Describe("Graph", func() {
|
||||
svc.GetSingleDrive(rr, r)
|
||||
Expect(rr.Code).To(Equal(http.StatusOK))
|
||||
|
||||
data, err := ioutil.ReadAll(rr.Body)
|
||||
data, err := io.ReadAll(rr.Body)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
drive := libregraph.Drive{}
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
|
||||
@@ -92,7 +92,7 @@ var _ = Describe("Groups", func() {
|
||||
svc.GetGroups(rr, r)
|
||||
|
||||
Expect(rr.Code).To(Equal(http.StatusBadRequest))
|
||||
data, err := ioutil.ReadAll(rr.Body)
|
||||
data, err := io.ReadAll(rr.Body)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
odataerr := libregraph.OdataError{}
|
||||
@@ -107,7 +107,7 @@ var _ = Describe("Groups", func() {
|
||||
r := httptest.NewRequest(http.MethodGet, "/graph/v1.0/me/groups", nil)
|
||||
svc.GetGroups(rr, r)
|
||||
Expect(rr.Code).To(Equal(http.StatusInternalServerError))
|
||||
data, err := ioutil.ReadAll(rr.Body)
|
||||
data, err := io.ReadAll(rr.Body)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
odataerr := libregraph.OdataError{}
|
||||
@@ -123,7 +123,7 @@ var _ = Describe("Groups", func() {
|
||||
svc.GetGroups(rr, r)
|
||||
|
||||
Expect(rr.Code).To(Equal(http.StatusInternalServerError))
|
||||
data, err := ioutil.ReadAll(rr.Body)
|
||||
data, err := io.ReadAll(rr.Body)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
odataerr := libregraph.OdataError{}
|
||||
@@ -139,7 +139,7 @@ var _ = Describe("Groups", func() {
|
||||
svc.GetGroups(rr, r)
|
||||
|
||||
Expect(rr.Code).To(Equal(http.StatusOK))
|
||||
data, err := ioutil.ReadAll(rr.Body)
|
||||
data, err := io.ReadAll(rr.Body)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
res := service.ListResponse{}
|
||||
@@ -155,7 +155,7 @@ var _ = Describe("Groups", func() {
|
||||
svc.GetGroups(rr, r)
|
||||
|
||||
Expect(rr.Code).To(Equal(http.StatusOK))
|
||||
data, err := ioutil.ReadAll(rr.Body)
|
||||
data, err := io.ReadAll(rr.Body)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
res := groupList{}
|
||||
@@ -385,7 +385,7 @@ var _ = Describe("Groups", func() {
|
||||
svc.GetGroupMembers(rr, r)
|
||||
Expect(rr.Code).To(Equal(http.StatusOK))
|
||||
|
||||
data, err := ioutil.ReadAll(rr.Body)
|
||||
data, err := io.ReadAll(rr.Body)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
var members []*libregraph.User
|
||||
|
||||
@@ -3,8 +3,8 @@ package svc
|
||||
import (
|
||||
"crypto/tls"
|
||||
"crypto/x509"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"os"
|
||||
"strconv"
|
||||
|
||||
"github.com/cs3org/reva/v2/pkg/rgrpc/todo/pool"
|
||||
@@ -113,7 +113,7 @@ func NewService(opts ...Option) Service {
|
||||
}
|
||||
}
|
||||
certs := x509.NewCertPool()
|
||||
pemData, err := ioutil.ReadFile(options.Config.Identity.LDAP.CACert)
|
||||
pemData, err := os.ReadFile(options.Config.Identity.LDAP.CACert)
|
||||
if err != nil {
|
||||
options.Logger.Error().Err(err).Msgf("Error initializing LDAP Backend")
|
||||
return nil
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
|
||||
@@ -125,7 +125,7 @@ var _ = Describe("Users", func() {
|
||||
svc.GetUsers(rr, r)
|
||||
|
||||
Expect(rr.Code).To(Equal(http.StatusOK))
|
||||
data, err := ioutil.ReadAll(rr.Body)
|
||||
data, err := io.ReadAll(rr.Body)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
res := userList{}
|
||||
@@ -157,7 +157,7 @@ var _ = Describe("Users", func() {
|
||||
svc.GetUsers(rec, r)
|
||||
|
||||
Expect(rec.Code).To(Equal(http.StatusOK))
|
||||
data, err := ioutil.ReadAll(rec.Body)
|
||||
data, err := io.ReadAll(rec.Body)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
res := userList{}
|
||||
@@ -238,7 +238,7 @@ var _ = Describe("Users", func() {
|
||||
svc.GetUser(rr, r)
|
||||
|
||||
Expect(rr.Code).To(Equal(http.StatusOK))
|
||||
data, err := ioutil.ReadAll(rr.Body)
|
||||
data, err := io.ReadAll(rr.Body)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
responseUser := &libregraph.User{}
|
||||
err = json.Unmarshal(data, &responseUser)
|
||||
@@ -279,7 +279,7 @@ var _ = Describe("Users", func() {
|
||||
svc.GetUser(rr, r)
|
||||
|
||||
Expect(rr.Code).To(Equal(http.StatusOK))
|
||||
data, err := ioutil.ReadAll(rr.Body)
|
||||
data, err := io.ReadAll(rr.Body)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
responseUser := &libregraph.User{}
|
||||
err = json.Unmarshal(data, &responseUser)
|
||||
@@ -314,7 +314,7 @@ var _ = Describe("Users", func() {
|
||||
svc.GetUser(rr, r)
|
||||
|
||||
Expect(rr.Code).To(Equal(http.StatusOK))
|
||||
data, err := ioutil.ReadAll(rr.Body)
|
||||
data, err := io.ReadAll(rr.Body)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
responseUser := &libregraph.User{}
|
||||
err = json.Unmarshal(data, &responseUser)
|
||||
@@ -517,7 +517,7 @@ var _ = Describe("Users", func() {
|
||||
svc.PatchUser(rr, r)
|
||||
|
||||
Expect(rr.Code).To(Equal(http.StatusOK))
|
||||
data, err = ioutil.ReadAll(rr.Body)
|
||||
data, err = io.ReadAll(rr.Body)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
updatedUser := libregraph.User{}
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
"os"
|
||||
"path"
|
||||
@@ -143,7 +143,7 @@ func createTemporaryClientsConfig(filePath, ocisURL string, clients []config.Cli
|
||||
|
||||
defer confOnDisk.Close()
|
||||
|
||||
err = ioutil.WriteFile(filePath, conf, 0600)
|
||||
err = os.WriteFile(filePath, conf, 0600)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -253,7 +253,7 @@ func (idp IDP) Index() http.HandlerFunc {
|
||||
idp.logger.Fatal().Err(err).Msg("Could not open index template")
|
||||
}
|
||||
|
||||
template, err := ioutil.ReadAll(f)
|
||||
template, err := io.ReadAll(f)
|
||||
if err != nil {
|
||||
idp.logger.Fatal().Err(err).Msg("Could not read index template")
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package middleware
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"regexp"
|
||||
"strings"
|
||||
@@ -113,7 +112,7 @@ func Authentication(auths []Authenticator, opts ...Option) func(next http.Handle
|
||||
// https://github.com/golang/go/issues/15527
|
||||
|
||||
defer r.Body.Close()
|
||||
_, _ = io.Copy(ioutil.Discard, r.Body)
|
||||
_, _ = io.Copy(io.Discard, r.Body)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package middleware
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"net/http"
|
||||
"strings"
|
||||
"sync"
|
||||
@@ -181,7 +181,7 @@ func (m *OIDCAuthenticator) getKeyfunc() *keyfunc.JWKS {
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
body, err := ioutil.ReadAll(resp.Body)
|
||||
body, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
m.Logger.Error().Err(err).Msg("unable to read discovery response body")
|
||||
return nil
|
||||
|
||||
@@ -5,10 +5,10 @@ import (
|
||||
"crypto/x509"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/http/httputil"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
chimiddleware "github.com/go-chi/chi/v5/middleware"
|
||||
@@ -56,7 +56,7 @@ func NewMultiHostReverseProxy(opts ...Option) (*MultiHostReverseProxy, error) {
|
||||
}
|
||||
if options.Config.BackendHTTPSCACert != "" {
|
||||
certs := x509.NewCertPool()
|
||||
pemData, err := ioutil.ReadFile(options.Config.BackendHTTPSCACert)
|
||||
pemData, err := os.ReadFile(options.Config.BackendHTTPSCACert)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"net/url"
|
||||
@@ -133,7 +132,7 @@ func TestProxyIntegration(t *testing.T) {
|
||||
|
||||
return &http.Response{
|
||||
StatusCode: 200,
|
||||
Body: ioutil.NopCloser(bytes.NewBufferString(`OK`)),
|
||||
Body: io.NopCloser(bytes.NewBufferString(`OK`)),
|
||||
Header: make(http.Header),
|
||||
}
|
||||
})
|
||||
@@ -146,7 +145,7 @@ func TestProxyIntegration(t *testing.T) {
|
||||
t.Errorf("Expected status 200 from proxy-response got %v", rsp.StatusCode)
|
||||
}
|
||||
|
||||
resultBody, err := ioutil.ReadAll(rsp.Body)
|
||||
resultBody, err := io.ReadAll(rsp.Body)
|
||||
if err != nil {
|
||||
t.Fatal("Error reading result body")
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
package store
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
@@ -14,7 +13,7 @@ import (
|
||||
func (s Store) ListRoleAssignments(accountUUID string) ([]*settingsmsg.UserRoleAssignment, error) {
|
||||
var records []*settingsmsg.UserRoleAssignment
|
||||
assignmentsFolder := s.buildFolderPathForRoleAssignments(false)
|
||||
assignmentFiles, err := ioutil.ReadDir(assignmentsFolder)
|
||||
assignmentFiles, err := os.ReadDir(assignmentsFolder)
|
||||
if err != nil {
|
||||
return records, nil
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package store
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sync"
|
||||
|
||||
@@ -21,7 +21,7 @@ func (s Store) ListBundles(bundleType settingsmsg.Bundle_Type, bundleIDs []strin
|
||||
defer m.RUnlock()
|
||||
|
||||
bundlesFolder := s.buildFolderPathForBundles(false)
|
||||
bundleFiles, err := ioutil.ReadDir(bundlesFolder)
|
||||
bundleFiles, err := os.ReadDir(bundlesFolder)
|
||||
if err != nil {
|
||||
return []*settingsmsg.Bundle{}, nil
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package store
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"os"
|
||||
|
||||
"github.com/owncloud/ocis/v2/services/settings/pkg/store/errortypes"
|
||||
@@ -22,7 +22,7 @@ func (s Store) parseRecordFromFile(record proto.Message, filePath string) error
|
||||
}
|
||||
defer file.Close()
|
||||
|
||||
b, err := ioutil.ReadAll(file)
|
||||
b, err := io.ReadAll(file)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package store
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/gofrs/uuid"
|
||||
@@ -16,7 +16,7 @@ import (
|
||||
// If the accountUUID is not empty, values with an empty or with a matching accountUUID are returned.
|
||||
func (s Store) ListValues(bundleID, accountUUID string) ([]*settingsmsg.Value, error) {
|
||||
valuesFolder := s.buildFolderPathForValues(false)
|
||||
valueFiles, err := ioutil.ReadDir(valuesFolder)
|
||||
valueFiles, err := os.ReadDir(valuesFolder)
|
||||
if err != nil {
|
||||
return []*settingsmsg.Value{}, nil
|
||||
}
|
||||
@@ -61,7 +61,7 @@ func (s Store) ReadValue(valueID string) (*settingsmsg.Value, error) {
|
||||
// ReadValueByUniqueIdentifiers tries to find a value given a set of unique identifiers
|
||||
func (s Store) ReadValueByUniqueIdentifiers(accountUUID, settingID string) (*settingsmsg.Value, error) {
|
||||
valuesFolder := s.buildFolderPathForValues(false)
|
||||
files, err := ioutil.ReadDir(valuesFolder)
|
||||
files, err := os.ReadDir(valuesFolder)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package service
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
@@ -85,7 +84,7 @@ func (s *Service) Read(c context.Context, rreq *storesvc.ReadRequest, rres *stor
|
||||
|
||||
var data []byte
|
||||
rec := &storemsg.Record{}
|
||||
data, err := ioutil.ReadFile(file)
|
||||
data, err := os.ReadFile(file)
|
||||
if err != nil {
|
||||
return merrors.NotFound(s.id, "could not read record")
|
||||
}
|
||||
@@ -129,7 +128,7 @@ func (s *Service) Read(c context.Context, rreq *storesvc.ReadRequest, rres *stor
|
||||
dest := filepath.Join(s.Config.Datapath, "databases", hit.ID)
|
||||
|
||||
var data []byte
|
||||
data, err := ioutil.ReadFile(dest)
|
||||
data, err := os.ReadFile(dest)
|
||||
s.log.Info().Str("path", dest).Interface("hit", hit).Msgf("hit info")
|
||||
if err != nil {
|
||||
s.log.Info().Str("path", dest).Interface("hit", hit).Msgf("file not found")
|
||||
@@ -163,7 +162,7 @@ func (s *Service) Write(c context.Context, wreq *storesvc.WriteRequest, wres *st
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = ioutil.WriteFile(file, bytes, 0600)
|
||||
err = os.WriteFile(file, bytes, 0600)
|
||||
if err != nil {
|
||||
return merrors.InternalServerError(s.id, "could not write record")
|
||||
}
|
||||
@@ -302,7 +301,7 @@ func (s Service) indexRecords(recordsDir string) (err error) {
|
||||
// read record
|
||||
var data []byte
|
||||
rec := &storemsg.Record{}
|
||||
data, err = ioutil.ReadFile(kp)
|
||||
data, err = os.ReadFile(kp)
|
||||
if err != nil {
|
||||
s.log.Error().Err(err).Str("id", id).Msg("could not read record")
|
||||
continue
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
||||
"github.com/oklog/run"
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/config/configlog"
|
||||
@@ -36,7 +36,7 @@ func Server(cfg *config.Config) *cli.Command {
|
||||
|
||||
// actually read the contents of the config file and override defaults
|
||||
if cfg.File != "" {
|
||||
contents, err := ioutil.ReadFile(cfg.File)
|
||||
contents, err := os.ReadFile(cfg.File)
|
||||
if err != nil {
|
||||
logger.Err(err).Msg("error opening config file")
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user