summaryrefslogtreecommitdiffstats
path: root/app/models/changeset.rb
Commit message (Expand)AuthorAgeFilesLines
* Fix RuboCop offense Rails/ActiveRecordCallbacksOrder (#39889).Go MAEDA2024-06-171-1/+1
* Remove current year from source file copyright headers and update year in foo...Marius Balteanu2024-02-261-1/+1
* Use ApplicationRecord instead of ActiveRecord::Base (#38975).Marius Balteanu2024-01-231-1/+1
* Fix RuboCop offense Performance/ConstantRegexp (#38146).Go MAEDA2023-01-111-1/+1
* Update copyright year to 2023 (#38141).Go MAEDA2023-01-011-1/+1
* Ruby 3.2: `Changeset.normalize_comments` raises Encoding::CompatibilityError ...Go MAEDA2022-12-261-1/+1
* Fix RuboCop offense Rails/Pluck (#37248).Go MAEDA2022-10-281-1/+1
* Update copyright year in source files to 2022 (#36379).Go MAEDA2022-01-021-1/+1
* DEPRECATION WARNING: Uniqueness validator will no longer enforce case sensiti...Go MAEDA2021-04-011-2/+2
* Update copyright year in source files to 2021 (#33069).Go MAEDA2021-03-251-1/+1
* remove redundant 'return' from app/models/changeset.rbToshi MARUYAMA2020-12-191-1/+1
* shorten long line of app/models/changeset.rbToshi MARUYAMA2020-12-101-10/+23
* remove spaces inside {} of app/models/changeset.rbToshi MARUYAMA2020-11-171-1/+1
* use "do end" instead of {} at ActiveRecord scope lambda of app/models/changes...Toshi MARUYAMA2020-11-121-2/+2
* Evaluate acts_as_activity_provider's scope lazily (#33664).Go MAEDA2020-10-171-1/+1
* fix source indent of app/models/changeset.rbToshi MARUYAMA2020-09-261-2/+2
* fix source indent of app/models/changeset.rbToshi MARUYAMA2020-09-121-7/+8
* add empty line after guard clause to app/models/changeset.rbToshi MARUYAMA2020-07-211-0/+2
* remove spaces inside {} of app/models/changeset.rbToshi MARUYAMA2020-07-211-1/+1
* Update copyright year in source files to 2020 (#33069).Go MAEDA2020-03-031-1/+1
* Fix logging time via a commit message for project specific activities (#29838).Go MAEDA2020-02-111-7/+3
* Reverts r19478 (#32897).Go MAEDA2020-01-301-2/+2
* Fix 'DEPRECATION WARNING: Uniqueness validator will no longer enforce case se...Go MAEDA2020-01-281-2/+2
* code cleanup: rubocop: fix Layout/ElseAlignment in app/models/changeset.rbToshi MARUYAMA2019-10-091-5/+1
* code cleanup: fix source code comment in r18607Toshi MARUYAMA2019-10-071-1/+1
* code cleanup: rubocop: fix Lint/UselessAccessModifier in app/models/changeset.rbToshi MARUYAMA2019-10-071-8/+9
* Update copyright year.Go MAEDA2019-05-251-1/+1
* Enable frozen_string_literal for some files under app and lib directory (#265...Go MAEDA2019-03-161-1/+1
* Add "frozen_string_literal: false" for all files (#26561).Go MAEDA2019-03-151-0/+2
* Merged rails-5.1 branch (#23630).Jean-Philippe Lang2017-07-231-1/+0
* Update copyright.Jean-Philippe Lang2017-06-251-1/+1
* Make sure that the journal is not created if issue is saved.Jean-Philippe Lang2017-06-031-0/+2
* Updates copyright for 2016.Jean-Philippe Lang2016-03-131-1/+1
* find_referenced_issue_by_id fails with RangeError for large numbers (#21071).Jean-Philippe Lang2015-10-291-1/+1
* Keywords in commit messages: journal entries are created even if nothing was ...Jean-Philippe Lang2015-04-121-2/+5
* revert r13896 (#14534)Toshi MARUYAMA2015-03-201-11/+3
* Use attribute writers instead of before_create callback to normalize comments...Jean-Philippe Lang2015-01-181-3/+11
* Copyright update.Jean-Philippe Lang2015-01-111-1/+1
* Rewrites search engine to properly paginate results (#18631).Jean-Philippe Lang2014-12-121-2/+2
* Code cleanup.Jean-Philippe Lang2014-10-251-1/+1
* remove unneeded "references" of joinsToshi MARUYAMA2014-10-241-1/+0
* Fixed an SQL error with SQLServer (#14534).Jean-Philippe Lang2014-10-221-1/+1
* Merged rails-4.1 branch (#14534).Jean-Philippe Lang2014-10-221-3/+6
* Don't link multiple changesets from the same commit multiple times (#17931).Jean-Philippe Lang2014-10-051-1/+7
* update copyright year (#15977)Toshi MARUYAMA2014-01-291-1/+1
* Fixed Changeset#text_tag for changeset with hash and repository identifier (#...Jean-Philippe Lang2014-01-121-5/+6
* Rails4: replace deprecated find_by_id at Changeset classToshi MARUYAMA2013-12-291-1/+1
* code format cleanup app/models/changeset.rbToshi MARUYAMA2013-10-241-2/+6
* Ability to define commit keywords per tracker (#7590).Jean-Philippe Lang2013-10-131-5/+7
* Don't update issues nor log time when importing old changesets (#4823).Jean-Philippe Lang2013-10-051-2/+5
lass="nx">NewEncoder()) } // DetermineEncoding determines the encoding of an HTML document by examining // up to the first 1024 bytes of content and the declared Content-Type. // // See http://www.whatwg.org/specs/web-apps/current-work/multipage/parsing.html#determining-the-character-encoding func DetermineEncoding(content []byte, contentType string) (e encoding.Encoding, name string, certain bool) { if len(content) > 1024 { content = content[:1024] } for _, b := range boms { if bytes.HasPrefix(content, b.bom) { e, name = Lookup(b.enc) return e, name, true } } if _, params, err := mime.ParseMediaType(contentType); err == nil { if cs, ok := params["charset"]; ok { if e, name = Lookup(cs); e != nil { return e, name, true } } } if len(content) > 0 { e, name = prescan(content) if e != nil { return e, name, false } } // Try to detect UTF-8. // First eliminate any partial rune at the end. for i := len(content) - 1; i >= 0 && i > len(content)-4; i-- { b := content[i] if b < 0x80 { break } if utf8.RuneStart(b) { content = content[:i] break } } hasHighBit := false for _, c := range content { if c >= 0x80 { hasHighBit = true break } } if hasHighBit && utf8.Valid(content) { return encoding.Nop, "utf-8", false } // TODO: change default depending on user's locale? return charmap.Windows1252, "windows-1252", false } // NewReader returns an io.Reader that converts the content of r to UTF-8. // It calls DetermineEncoding to find out what r's encoding is. func NewReader(r io.Reader, contentType string) (io.Reader, error) { preview := make([]byte, 1024) n, err := io.ReadFull(r, preview) switch { case err == io.ErrUnexpectedEOF: preview = preview[:n] r = bytes.NewReader(preview) case err != nil: return nil, err default: r = io.MultiReader(bytes.NewReader(preview), r) } if e, _, _ := DetermineEncoding(preview, contentType); e != encoding.Nop { r = transform.NewReader(r, e.NewDecoder()) } return r, nil } // NewReaderLabel returns a reader that converts from the specified charset to // UTF-8. It uses Lookup to find the encoding that corresponds to label, and // returns an error if Lookup returns nil. It is suitable for use as // encoding/xml.Decoder's CharsetReader function. func NewReaderLabel(label string, input io.Reader) (io.Reader, error) { e, _ := Lookup(label) if e == nil { return nil, fmt.Errorf("unsupported charset: %q", label) } return transform.NewReader(input, e.NewDecoder()), nil } func prescan(content []byte) (e encoding.Encoding, name string) { z := html.NewTokenizer(bytes.NewReader(content)) for { switch z.Next() { case html.ErrorToken: return nil, "" case html.StartTagToken, html.SelfClosingTagToken: tagName, hasAttr := z.TagName() if !bytes.Equal(tagName, []byte("meta")) { continue } attrList := make(map[string]bool) gotPragma := false const ( dontKnow = iota doNeedPragma doNotNeedPragma ) needPragma := dontKnow name = "" e = nil for hasAttr { var key, val []byte key, val, hasAttr = z.TagAttr() ks := string(key) if attrList[ks] { continue } attrList[ks] = true for i, c := range val { if 'A' <= c && c <= 'Z' { val[i] = c + 0x20 } } switch ks { case "http-equiv": if bytes.Equal(val, []byte("content-type")) { gotPragma = true } case "content": if e == nil { name = fromMetaElement(string(val)) if name != "" { e, name = Lookup(name) if e != nil { needPragma = doNeedPragma } } } case "charset": e, name = Lookup(string(val)) needPragma = doNotNeedPragma } } if needPragma == dontKnow || needPragma == doNeedPragma && !gotPragma { continue } if strings.HasPrefix(name, "utf-16") { name = "utf-8" e = encoding.Nop } if e != nil { return e, name } } } } func fromMetaElement(s string) string { for s != "" { csLoc := strings.Index(s, "charset") if csLoc == -1 { return "" } s = s[csLoc+len("charset"):] s = strings.TrimLeft(s, " \t\n\f\r") if !strings.HasPrefix(s, "=") { continue } s = s[1:] s = strings.TrimLeft(s, " \t\n\f\r") if s == "" { return "" } if q := s[0]; q == '"' || q == '\'' { s = s[1:] closeQuote := strings.IndexRune(s, rune(q)) if closeQuote == -1 { return "" } return s[:closeQuote] } end := strings.IndexAny(s, "; \t\n\f\r") if end == -1 { end = len(s) } return s[:end] } return "" } var boms = []struct { bom []byte enc string }{ {[]byte{0xfe, 0xff}, "utf-16be"}, {[]byte{0xff, 0xfe}, "utf-16le"}, {[]byte{0xef, 0xbb, 0xbf}, "utf-8"}, }